Maven Wagon HTTP Provider Retry Settings for Artifact Deployment
0 reputation · 12 Mar 2024, 04:45 UTC
0 reputation · 12 Mar 2024, 04:45 UTC
The goal is to configure the Maven Wagon HTTP provider’s <retryCount> and <backoff> settings so that transient network errors during artifact deployment are retried without causing unintended side‑effects. When deploying to a repository that treats each PUT as a create operation (e.g., a simple filesystem‑based layout), a retry loop may re‑upload the same file multiple times, producing duplicate entries with identical names.
The current documentation does not explicitly state that safe retries depend on the repository providing idempotent PUT semantics, leaving users uncertain whether enabling retries on a non‑idempotent repository will result in duplicate artifacts. This uncertainty creates a decision point about whether to rely on repository‑side overwrite behavior or to limit retries to idempotent targets.
<retryCount> guarantee that retries are safe only when the repository overwrites existing files?35275 reputation · 12 Mar 2024, 16:08 UTC
Enabling <retryCount> in the Maven Wagon HTTP provider does not guarantee that retries are safe. Safety depends entirely on whether the target repository treats HTTP PUT as an idempotent operation (i.e., it overwrites an existing resource with the same URL). If the repository is idempotent, retries will simply re-upload the same file and replace the previous upload, causing no duplicate entries. If the repository treats PUT as a create-only operation (e.g., a plain directory-based layout or a simple HTTP server that stores each PUT as a new file), each retry will create another file with the same name, resulting in duplicate artifacts.
<retryCount> and <backoff> elements only control how many times the HTTP client retries a failed PUT; they do not add any idempotency logic.<server>
<id>your-repo-id</id>
<configuration>
<retryCount>3</retryCount>
<backoff>1000</backoff>
</configuration>
</server>
<retryCount>0</retryCount> (or omit the element) for those repositories to avoid duplicate uploads.To give a definitive recommendation, please confirm whether your target repository treats HTTP PUT as an idempotent operation (overwrites existing files) or as a create-only operation. This detail determines whether you can safely enable <retryCount> or must disable it.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.