简体   繁体   中英

Unable to deploy maven artifact to maven central repository using travis

I am trying to deploy maven artifact to central repository through Travis but I am facing below error:

[ERROR] Failed to execute goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.7:deploy (injected-nexus-deploy) on project Test-plugin: Execution injected-nexus-deploy of goal org.sonatype.plugins:nexus-staging-maven-plugin:1.6.7:deploy failed: Nexus connection problem to URL [https://oss.sonatype.org/ ]: 401 - Unauthorized -> [Help 1]

I have set correct username and password for sonatype account, still I am getting the same error. Below are the files uploaded: .travis.yml settings.xml

Looks like your settings.xml in the .m2 folder in your home directory is not having proper authorization properties set for maven to look

I am enclosing a sample XML for your reference ..

https://maven.apache.org/settings.html

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
                      https://maven.apache.org/xsd/settings-1.0.0.xsd">   ...   <servers>
    <server>
      <id>server001</id>
      <username>my_login</username>
      <password>my_password</password>
      <privateKey>${user.home}/.ssh/id_dsa</privateKey>
      <passphrase>some_passphrase</passphrase>
      <filePermissions>664</filePermissions>
      <directoryPermissions>775</directoryPermissions>
      <configuration></configuration>
    </server>   </servers>   ... </settings>

Here is the troubleshooting guide if you are getting 404

https://support.sonatype.com/hc/en-us/articles/213464518-Troubleshooting-Artifact-Download-Failures

From the docs

SNAPSHOT look-ups, or version ranges, or unversioned dependencies (typically plugins) will trigger metadata look-up. If the version referenced by the maven-metadata.xml is not there you will get a 404.

This can usually be fixed by running rebuild metadata on the affected artifact.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM