jx: Failed to deploy artifacts: Could not transfer artifact
I finished jx install then $ jx create spring -d web -d actuator, but something wrong in the end of building process.
It likes jx don’t have nexus password, but I find the password at jenkins-maven-settings in k8s. And I also find the username and password in the file .
<settings>
<!-- sets the local maven repository outside of the ~/.m2 folder for easier mounting of secrets and repo -->
<localRepository>${user.home}/.mvnrepository</localRepository>
<!-- lets disable the download progress indicator that fills up logs -->
<interactiveMode>false</interactiveMode>
<mirrors>
<mirror>
<id>nexus</id>
<mirrorOf>external:*</mirrorOf>
<url>http://nexus/repository/maven-group/</url>
</mirror>
</mirrors>
<servers>
<server>
<id>local-nexus</id>
<username>admin</username>
<password>foxroad</password>
</server>
</servers>
<profiles>
<profile>
<id>nexus</id>
<properties>
<altDeploymentRepository>local-nexus::default::http://nexus/repository/maven-snapshots/</altDeploymentRepository>
<altReleaseDeploymentRepository>local-nexus::default::http://nexus/repository/maven-releases/</altReleaseDeploymentRepository>
<altSnapshotDeploymentRepository>local-nexus::default::http://nexus/repository/maven-snapshots/</altSnapshotDeploymentRepository>
</properties>
</profile>
<profile>
<id>release</id>
<properties>
<gpg.executable>gpg</gpg.executable>
<gpg.passphrase>mysecretpassphrase</gpg.passphrase>
</properties>
</profile>
</profiles>
<activeProfiles>
<!--make the profile active all the time -->
<activeProfile>nexus</activeProfile>
</activeProfiles>
</settings>
[INFO] Installing /home/jenkins/workspace/clsaa_demo_master-6FA3G2D6MXHSYBLQSBJZN7WZYHSCXPU34BFU2FYLUABSJZHBVB3Q/target/demo-0.0.1.jar to /root/.mvnrepository/com/clsaa/demo/0.0.1/demo-0.0.1.jar
[INFO] Installing /home/jenkins/workspace/clsaa_demo_master-6FA3G2D6MXHSYBLQSBJZN7WZYHSCXPU34BFU2FYLUABSJZHBVB3Q/pom.xml to /root/.mvnrepository/com/clsaa/demo/0.0.1/demo-0.0.1.pom
[INFO]
[INFO] --- maven-deploy-plugin:2.8.2:deploy (default-deploy) @ demo ---
[INFO] Using alternate deployment repository local-nexus::default::http://nexus/repository/maven-releases/
[INFO] Uploading to local-nexus: http://nexus/repository/maven-releases/com/clsaa/demo/0.0.1/demo-0.0.1.jar
[INFO] Uploading to local-nexus: http://nexus/repository/maven-releases/com/clsaa/demo/0.0.1/demo-0.0.1.pom
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 08:45 min
[INFO] Finished at: 2018-10-21T10:57:07Z
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.8.2:deploy (default-deploy) on project demo: Failed to deploy artifacts: Could not transfer artifact com.clsaa:demo:jar:0.0.1 from/to local-nexus (http://nexus/repository/maven-releases/): Failed to transfer file: http://nexus/repository/maven-releases/com/clsaa/demo/0.0.1/demo-0.0.1.jar. Return code is: 401, ReasonPhrase: Unauthorized. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[Pipeline] }
[Pipeline] // container
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Promote to Environments)
Stage "Promote to Environments" skipped due to earlier failure(s)
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Declarative: Post Actions)
[Pipeline] cleanWs
[WS-CLEANUP] Deleting project workspace...[WS-CLEANUP] done
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Reactions: 3
- Comments: 19 (11 by maintainers)
I had the same problem after a recent upgrade of jenkins x platform to 0.0.3320 (not sure which version I had before, but it used to worked ok). The problem is with the
local-nexusserver id which does not match thenexusmirror id, so the credentials are not applied. A solution that I applied directly in the “Replay” pipeline while investigating the issue was to:To fix it more properly you can edit the
jenkins-maven-settingssecret and change the mirror id.Strange thing is that the MavenSettingsXML at jenkins-x-platform/values.yaml has not changed any time recently, so the real cause for the error may be somewhere else.