When the Maven release plugin publishes a version to the warehouse, return code is:401, reasonphrase:unauthorized

Source: Internet
Author: User

You need to configure the Servers.server node in Maven's setting.xml with the value of the corresponding Repository ID and username and password for the Nexus

[HTML]View PlainCopy
  1. <servers>
  2. <server>
  3. <ID>releases</ID>
  4. <username>admin</username>
  5. <password>admin</password>
  6. </Server>
  7. <server>
  8. <ID>snapshots</ID>
  9. <username>deployment</username>
  10. <password>deployment</password>
  11. </Server>
  12. </Servers>

MVN release:prepare-pxxxx will use the profile defined in Setting.xml to submit for us, tag, upgrade Pom, and then submit a series of actions ( But do not forget the Setting.xml profile definition and pom.xm defined in the Maven-release-plugin Tagbase,username,password and SCM information for each module)

Maven Conf/setting.xml

[HTML]View PlainCopy
  1. <profiles>
  2. <profile>
  3. <ID>xxxx</ID>
  4. <properties>
  5. <svn.name>username</svn.name>
  6. <svn.pwd>password</svn.pwd>
  7. </Properties>
  8. </profile>
  9. </Profiles>

Project Pom.xml (let submodules inherit from another module, type Pom, assuming the name is parent)

[HTML]View PlainCopy
  1. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi= "http://www.w3.org/2001/ Xmlschema-instance " xsi:schemalocation=" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/ Maven-4.0.0.xsd ">
  2. <modelversion>4.0.0</modelversion>
  3. <parent>
  4. <groupId>xxx.xx.xxx</groupId>
  5. <artifactid>xxxx</artifactid>
  6. <version>0.3-snapshot</version>
  7. </Parent>
  8. <groupId><u><span style="color: #0066cc;" >xxx.xx.xxx</span></u></groupId>
  9. <artifactid>parent</artifactid>
  10. <name>parent</name>
  11. <packaging>pom</packaging>
  12. <SCM>
  13. <connection>scm:svn:https://192.168.1.88/svn/xxxx/trunk/parent</Connection >
  14. <URL>https://192.168.1.88/svn/xxxx/trunk/parent</url>
  15. </SCM>
  16. <build>
  17. <plugins>
  18. <plugin>
  19. <groupId>org.apache.maven.plugins</groupId>
  20. <artifactid>maven-release-plugin</artifactid>
  21. <configuration>
  22. <tagbase>https://192.168.1.88/svn/xxxx/tags/</tagbase>
  23. <username>${svn.name}</username>
  24. <password>${svn.pwd}</password>
  25. </configuration>
  26. </plugin>
  27. </plugins>
  28. </Build>
  29. </Project>




In this way mvn Release:perform will automatically check out the tag we just made, then package it and distribute it to the remote Maven repository (Nexus).

Note: If you want to publish the snapshot version to the repository, you need to perform mvn deploy in the trunk and be sure to configure the Snapshotrepository

When the Maven release plugin publishes a version to the warehouse, return code is:401, reasonphrase:unauthorized

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.