nexus configuration file failed to local maven local repository

Failed to execute goal org.apache.maven.plugins:maven-deploy-plugin:2.7:deploy (default-deploy) on project maven_day02_dao: Failed to deploy artifacts: Could not transfer artifact com.itheima:maven_day02_dao:jar:1.0-20200420.150331-1 from/to Snapshots (http://localhost:8081/nexus/content/repositories/snapshots/): Failed to transfer file: http://localhost:8081/nexus/content/repositories/snapshots/com/itheima/maven_day02_dao/1.0-SNAPSHOT/maven_day02_dao-1.0-20200420.150331-1.jar. Return code is: 401, ReasonPhrase: Unauthorized.

 

 

Reason: The ID, account or password of my local maven configuration failed verification. At last look, it turned out to be snapshotRepository id and project configuration inside the configuration maven Id which is not the same (maven inside the already exist), and then just add it in the pom project, because the result is " case sensitive ".

 

 

 Steps of nexus configuration file to local maven local warehouse

1. Added under the <servers> node in the Settings.Xml file of maven

 

  <server>
         <id>releases</id>
         <username>admin</username>
         <password>admin123</password>
     </server>
    <server>
         <id>Snapshots</id>
         <username>admin</username>
         <password>admin123</password>
     </server>

In the project node of the pom.xml file in the project (generally placed at the end, it can be detailed to each module)

 

<distributionManagement>
    <repository>
        <id>releases</id>
        <url>http://localhost:8081/nexus/content/repositories/releases/</url>
    </repository>
    <snapshotRepository>
        <id>snapshots</id>
        <url>http://localhost:8081/nexus/content/repositories/snapshots/</url>
    </snapshotRepository>
</distributionManagement>


id = snapshots corresponds to the type of compilation in the version of Pom.xml, such as <version> 1.0-SNAPSHOT </ version>

3. Compile to nexus,

Guess you like

Origin www.cnblogs.com/zhian/p/12741577.html