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
- <servers>
- <server>
- <ID>releases</ID>
- <username>admin</username>
- <password>admin</password>
- </Server>
- <server>
- <ID>snapshots</ID>
- <username>deployment</username>
- <password>deployment</password>
- </Server>
- </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
- <profiles>
- <profile>
- <ID>xxxx</ID>
- <properties>
- <svn.name>username</svn.name>
- <svn.pwd>password</svn.pwd>
- </Properties>
- </profile>
- </Profiles>
Project Pom.xml (let submodules inherit from another module, type Pom, assuming the name is parent)
[HTML]View PlainCopy
- <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 ">
- <modelversion>4.0.0</modelversion>
- <parent>
- <groupId>xxx.xx.xxx</groupId>
- <artifactid>xxxx</artifactid>
- <version>0.3-snapshot</version>
- </Parent>
- <groupId><u><span style="color: #0066cc;" >xxx.xx.xxx</span></u></groupId>
- <artifactid>parent</artifactid>
- <name>parent</name>
- <packaging>pom</packaging>
- <SCM>
- <connection>scm:svn:https://192.168.1.88/svn/xxxx/trunk/parent</Connection >
- <URL>https://192.168.1.88/svn/xxxx/trunk/parent</url>
- </SCM>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactid>maven-release-plugin</artifactid>
- <configuration>
- <tagbase>https://192.168.1.88/svn/xxxx/tags/</tagbase>
- <username>${svn.name}</username>
- <password>${svn.pwd}</password>
- </configuration>
- </plugin>
- </plugins>
- </Build>
- </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