From f1a0513e371ba38e5bb07395a75a07c68eba7249 Mon Sep 17 00:00:00 2001 From: Pablo Alcaraz Date: Tue, 27 Sep 2016 18:48:11 -0700 Subject: [PATCH] Added property "retryFailedDeploymentDelay". This property impose a delay between 0 seconds to 5 minutes (max) between retries. Default value: 20 seconds. The intention is to make maven-deploy-plugin more solid and stable when network glitches happens. ticket https://issues.apache.org/jira/browse/MDEPLOY-214 in maven-deploy-plugin has the details. --- .../maven/plugins/deploy/AbstractDeployMojo.java | 14 ++++++++++++++ .../apache/maven/plugins/deploy/DeployMojo.java | 1 + 2 files changed, 15 insertions(+) diff --git a/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/AbstractDeployMojo.java b/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/AbstractDeployMojo.java index bc9c4c072a..2a93e28fd7 100644 --- a/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/AbstractDeployMojo.java +++ b/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/AbstractDeployMojo.java @@ -66,6 +66,15 @@ public abstract class AbstractDeployMojo @Parameter( property = "retryFailedDeploymentCount", defaultValue = "1" ) private int retryFailedDeploymentCount; + /** + * Parameter used to control how much time (in seconds) a failed deployment will be retried after a failed + * connection. + * + * @since 2.9 + */ + @Parameter( property = "retryFailedDeploymentDelay", defaultValue = "20" ) + private int retryFailedDeploymentDelay; + @Parameter( defaultValue = "${session}", readonly = true, required = true ) private MavenSession session; @@ -103,6 +112,11 @@ int getRetryFailedDeploymentCount() return retryFailedDeploymentCount; } + int getRetryFailedDeploymentDelay() + { + return retryFailedDeploymentDelay; + } + protected ArtifactRepository createDeploymentArtifactRepository( String id, String url, ArtifactRepositoryLayout layout, boolean uniqueVersion2 ) diff --git a/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java b/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java index 02c08806d8..418244a99d 100644 --- a/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java +++ b/maven-deploy-plugin/src/main/java/org/apache/maven/plugins/deploy/DeployMojo.java @@ -151,6 +151,7 @@ public void execute() .setProject( project ) .setUpdateReleaseInfo( isUpdateReleaseInfo() ) .setRetryFailedDeploymentCount( getRetryFailedDeploymentCount() ) + .setRetryFailedDeploymentDelay( getRetryFailedDeploymentDelay() ) .setAltReleaseDeploymentRepository( altReleaseDeploymentRepository ) .setAltSnapshotDeploymentRepository( altSnapshotDeploymentRepository ) .setAltDeploymentRepository( altDeploymentRepository );