Skip to content

Retry external artifact downloads on transient network failures#179

Merged
vharseko merged 1 commit into
masterfrom
copilot/add-retry-download-attempts
May 6, 2026
Merged

Retry external artifact downloads on transient network failures#179
vharseko merged 1 commit into
masterfrom
copilot/add-retry-download-attempts

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented May 6, 2026

External artifact downloads in maven-external-dependency-plugin failed the build on a single transient java.net.ConnectException: Connection timed out, since wagon.get(...) was invoked exactly once with a 5s default timeout.

Changes

  • Retry loop around Wagon download (ResolveExternalDependencyMojo): up to N attempts, WARN-logged with attempt counter and cause, wagon.disconnect() in finally, partial temp file deleted between attempts, Thread.sleep(retryDelay) between attempts (interrupt-safe). On exhaustion throws MojoExecutionException("Failed to download artifact <url> after N attempt(s)", lastFailure).
  • Fail-fast on auth errors: AuthorizationException is not retried.
  • New Mojo parameters with defaults: downloadRetryAttempts=5, downloadTimeout=10000, downloadRetryDelay=2000.
  • Per-artifact overrides on <artifactItem>: timeout, retryAttempts, retryDelay — take precedence over Mojo-level defaults when explicitly set (preserves backward compatibility). Added ArtifactItem.getTimeoutRaw() so the resolver can distinguish "unset" from the existing defaulted getter.
  • Default timeout in ArtifactItem.getTimeout() raised from 5s → 10s.
  • README updated with the new parameters table and override semantics.

Example

<plugin>
  <groupId>com.savage7.maven.plugins</groupId>
  <artifactId>maven-external-dependency-plugin</artifactId>
  <configuration>
    <downloadRetryAttempts>5</downloadRetryAttempts>
    <downloadTimeout>10000</downloadTimeout>
    <downloadRetryDelay>2000</downloadRetryDelay>
    <artifactItems>
      <artifactItem>
        <!-- per-artifact override -->
        <retryAttempts>10</retryAttempts>
        <timeout>30000</timeout>
        ...
      </artifactItem>
    </artifactItems>
  </configuration>
</plugin>

@vharseko vharseko requested a review from maximthomas May 6, 2026 11:21
@vharseko vharseko marked this pull request as ready for review May 6, 2026 11:21
@vharseko vharseko merged commit eac858b into master May 6, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants