Releasing Maven Artifacts on Slow Networks

Maven logo Peter Major found this for me. I was running mvn release:perform and failing in the deploy goal, but only for a .jar, not for the POM.

[INFO] --- maven-deploy-plugin:2.7:deploy (default-deploy) @ forgerock-doc-maven-plugin ---
   Uploading: http://maven.forgerock.org/repo/releases/org/forgerock/commons/forgerock-doc-maven-plugin/1.2.0/forgerock-doc-maven-plugin-1.2.0.jar
   Uploading: http://maven.forgerock.org/repo/releases/org/forgerock/commons/forgerock-doc-maven-plugin/1.2.0/forgerock-doc-maven-plugin-1.2.0.pom
   Uploaded: http://maven.forgerock.org/repo/releases/org/forgerock/commons/forgerock-doc-maven-plugin/1.2.0/forgerock-doc-maven-plugin-1.2.0.pom (8 KB at 3.2 KB/sec)
   [INFO] ------------------------------------------------------------------------
   [INFO] BUILD FAILURE
   [INFO] ------------------------------------------------------------------------
   [INFO] Total time: 1:22.027s
   [INFO] Finished at: Thu May 23 13:17:03 CEST 2013
   [INFO] Final Memory: 30M/360M
   [INFO] ------------------------------------------------------------------------
   [ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project forgerock-doc-maven-plugin: Failed to deploy artifacts: Could not transfer artifact org.forgerock.commons:forgerock-doc-maven-plugin:jar:1.2.0 from/to forgerock-staging (http://maven.forgerock.org/repo/releases): Error transferring file: Error writing to server -> [Help 1]

This was with mvn 3.0.3.

The tcpdump capture showed that the HTTP PUT for the .jar was done without authentication. Artifactory was responding with HTTP 401 before our slow ADSL uplink could finish the request, and the client was not trying again with authentication for the .jar. But the client was trying again with authentication for the much smaller pom.xml. So the pom.xml was successfully uploaded, but the deploy failed because the .jar was not.

It feels odd for the deploy plugin to try an HTTP PUT without authenticating, but it turns out that performing authentication like this requires some preemptive authentication configuration in ~/.m2/settings.xml. That works apparently with mvn 3.0.4 or later.

So I updated the configuration for the release repository and tried again with mvn 3.0.5.

PATH=~/Downloads/apache-maven-3.0.5/bin:$PATH ~/Downloads/apache-maven-3.0.5/bin/mvn release:perform
...
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD SUCCESS
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 2:10.512s
    [INFO] Finished at: Thu May 23 15:19:47 CEST 2013
    [INFO] Final Memory: 31M/358M
    [INFO] ------------------------------------------------------------------------

Glad that’s done.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s