Wednesday, May 8, 2013

Return code is: 401, ReasonPhrase:Unauthorized. -> [Help 1]: Nexus error via Maven via Jenkins when using a slave node: Solved


[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project project: Failed to deploy artifacts: Could not transfer artifact com.company:project:jar:build_id from/to dirname (http://server:port/nexus/content/repositories/snapshots): Failed to transfer file: http://server:port/nexus/content/repositories/snapshots/com/company/product/build_id/product-build_id.jar. Return code is: 401, ReasonPhrase:Unauthorized. -> [Help 1]

(Output modified to protect the innocent.)

I have Maven builds running on a Jenkins master with slave nodes.  The deploy goal attempts to push artifacts from the build out to our Nexus instance.

To address this issue I had to add settings.xml to the Jenkins slave owner's .m2 directory as this is used during the upload to Nexus, not the settings.xml in the .m2 directory on the Jenkins master box.

No comments:

Post a Comment