LoginSignup
0
0

More than 3 years have passed since last update.

Nexus repository manager に mvn deploy したら Return code is: 401, ReasonPhrase: Unauthorized.

Posted at

経緯

別サーバにたてている Nexus Repository Managerpom.xml をデプロイしようとしたら Return code is: 401, ReasonPhrase: Unauthorized. が発生して BUILD FAILURE になった。

C:\xxx>mvn deploy
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building xxx x.x.x-SNAPSHOT
[INFO] ------------------------------------------------------------------------

...

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.540 s
[INFO] Finished at: 2019-09-18T10:47:41+09:00
[INFO] Final Memory: 11M/245M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project xxx: Failed to deploy artifacts: Could not transfer artifact xxx from/to xxx-snapshot (http://xx.xx.xx.xx/nexus/repository/snapshot/): Failed to transfer file: http://xx.xx.xx.xx/nexus/repository/snapshot/xxx. 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

解決方法

C:\Users\{your-username}\.m2\settings.xml にデプロイ先のサーバ情報が記述されていなかったので、追加することで解決。

pom.xml
  <distributionManagement>
    <snapshotRepository>
      <id>xxx-snapshot</id>
      <name>Snapshots</name>
      <url>http://xxx/nexus/repository/snapshot/</url>
    </snapshotRepository>
  </distributionManagement>

settings.xml
<settings>
    <servers>
        <server>
            <id>xxx-snapshot</id>
            <username>xxx</username>
            <password>xxx</password>
        </server>
    </servers>
</settings>
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0