wzNewFace00 2013-11-27
操作方式说明
1.在文件系统中,运行相应的命令如mvn release:clean,mvn release:prepare,mvn release:perform 等都要以mvn开头
后面接相应的命令操作
2.在IDE中,我们在maven的运行中,只需要输入release:clean,release:prepare等就可以了,要去掉mvn
命令可以连接起来一起用,如 mvn release:clean release:prepare release:perform中间以空格分开。
重要配置说明(pom.xml):
第一点:
<version>0.0.2-SNAPSHOT</version>,pom.xml中的vesion必需要以SNAPSHOT结尾
第二点: scm的配置,<!--connection, developerConnection: 都是连接字符串,其中后者是具有write权限的scm连接 -->
<!-- auto release version to svn server-->
<scm>
<!-- release version -->
<connection>scm:svn:https://localhost/svn/gzepro/trunk</connection>
<developerConnection>scm:svn:https://localhost/svn/gzepro/trunk</developerConnection>
<!-- <url>svn:https://localhost/svn/gzepro/trunk</url> -->
</scm>
第三点:plugin的配置中,需要配置svn用户的用户句和密码,同时还要配置好tag目录
<build>
<finalName>nexusdemo</finalName>
<plugins>
<plugin>
<artifactId>maven-release-plugin</artifactId>
<version>2.4.2</version>
<configuration>
<username>zjw</username>
<password>zjw</password>
<tagBase>https://localhost/svn/gzepro/tags</tagBase>
<releaseProfiles>release</releaseProfiles>
</configuration>
</plugin>
</plugins>
</build>
第四点:用于部署时需要的配置
<!-- mvn deploy command-->
<distributionManagement>
<!-- used for release -->
<repository>
<id>releases</id>
<name>Releases</name>
<url>http://127.0.0.1:8082/nexus/content/repositories/releases/</url>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Snapshots</name>
<url>http://127.0.0.1:8082/nexus/content/repositories/snapshots/</url>
</snapshotRepository>
</distributionManagement>
第五点:settings.xml中nexus私服的配置,注意,此处的id要与第四点的id配置相同
<servers>
<server>
<id>releases</id>
<username>dpuser</username>
<password>1234</password>
</server>
<server>
<id>snapshots</id>
<username>dpuser</username>
<password>1234</password>
</server>
</servers>
第六点:关于第五点中用户名和密码,需要在nexues中配置好相应的用户信息以及权限等.
详细配置在下面的附件中:
参考:
http://www.java-tutorial.ch/maven/maven-release
http://maven.apache.org/guides/mini/guide-releasing.html
http://hi.baidu.com/victorlin23/item/2fa37c7d27b924295c178997
http://www.l99.com/EditText_view.action?textId=459286
http://maven.apache.org/maven-release/maven-release-plugin/
maven 管理项目实践指南(多模块开发详解)
http://www.2cto.com/kf/201301/184469.html