1. Write the pom file as follows:
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.4.1</version>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<version>2.7</version>
<configuration>
<updateReleaseInfo>true</updateReleaseInfo>
</configuration>
</plugin>
</build>
1 Release Plugins 1 Deploy plugins
2. Set the username and password in the Nexus
<server>
<id>ci-release</id>
<username> User name </username>
<password> Password </password>
</server>
<server>
<id>ci-snapshot</id>
<username> User name </username>
<password> Password </password>
</server>
3. Packaging Management
<distributionManagement>
<repository>
<id>ci-release</id>
<name>internal releases</name>
<URL>HTTP://IP Address: Port/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>ci-snapshot</id>
<name>internal snapshots</name>
<url>http://192.168.156.138:8088/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
4. Set SVN (SCM tag Settings SVN, CVS save address )
<scm>
<CONNECTION>SCM:SVN:HTTPS://IP Address: Port/svn/psplatform_bs/trunk/bj-gbplatform</connection>
<DEVELOPERCONNECTION>SCM:SVN:HTTPS://IP: Port/svn/psplatform_bs/trunk/bj-gbplatform</developerconnection >
<url>https://192.168.152.88: Port/svn/psplatform_bs/trunk/bj-gbplatform</url>
</scm>
5. Since the War package import (common code) depends on the use of
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.2</version>
<configuration>
<outputDirectory>${dir.tomcat.deploy}</outputDirectory>
<warName>gb-monitor</warName>
<overlays>
<overlay>
<skip>${common.web.overlay.skip}</skip>
<groupId>com.ibs.gbplatform.common.core</groupId>
<artifactId>gbplatform-common-web</artifactId>
<excludes>
<exclude>**/web.xml</exclude>
<exclude>**/WEB-INF/lib/**</exclude>
<exclude>**/GBApp/**</exclude>
<exclude>**/MyDesktop/**</exclude>
<exclude>**/MCApp/**</exclude>
<exclude>**/ibssig*/**</exclude>
</excludes>
</overlay>
</overlays>
</configuration>
</plugin>
6. In Pom.xml, right-click Run As→maven build running clean deploy package to Nexus (Modify IP address package for different servers and server)
Release version of 7.Maven
Use the MVN release:prepare command under the cmd command under the project directory (Maven-release-plugin)
For more details, see MAVEN's release Mvn-release-plugin command
8. Package release is successful!
Common Command collection for 9.Maven
maven Common commands:
1. Create a generic Java project for maven:
mvn archetype:create
-dgroupid=packagename
-dartifactid=projectname
2. Create a MAVEN Web project:
mvn archetype:create
-dgroupid=packagename
-dartifactid=webappname
-darchetypeartifactid=maven-archetype-webapp
3. Compiling source code: MVN Compile
4. Compiling test code: MVN test-compile
5. Run the test: MVN Test
6. Generate SITE:MVN Site
7. Packaging: MVN Package
8. Installing the JAR:MVN install in the local repository
9. Clear the resulting project: MVN clean
10. Build Eclipse Project: MVN eclipse:eclipse
11. Generate the Idea project: MVN Idea:idea
12. Combine with goal commands, such as package-only not tested: Mvn-dtest packages
13. Compile the content of the test: mvn test-compile
14. Only hit jar package: MVN Jar:jar
15. Test without compiling and not compiling: mvn test-skipping compile-skipping test-compile
(-skipping's flexible use, of course, can also be used for other combination commands)
16. Clear some system settings for Eclipse: mvn Eclipse:clean
This article from the "Immortal High Place Cold" blog, reproduced please contact the author!
Packages of MAVEN projects are released to the Nexus and server