1 向私有仓库中部署 第三方 jar 包的命令

mvn deploy:deploy-file -DgroupId=com.ruixue.rop -DartifactId=sdk -Dversion=1.1 -Dpackaging=jar -Dfile=./RopExSdk.jar -Durl=http://115.159.22.92:8090/nexus/content/repositories/releases/ -DrepositoryId=[在 settings.xml 中 server >id 节点的值]

2 向私有仓库中部署第三方 快照包的命令

mvn deplofy:deploy-file -DgroupId=com.ruixue.rop -DartifactId=sdk -Dversion=1.1-SNAPSHOT -Dpackaging=jar -Dfile=./RopExSdk.jar -Durl=http://115.159.22.92:8090/nexus/content/repositories/snapshots/ -DrepositoryId=snapshots

3 使用scm

配置scm信息

 <scm>
<connection>scm:svn:svn://pub.ipay.sina.com/sina-pay-center/project/wallet/30.sourcecode/trunk</connection>
<!-- 要使用scm的项目的pom所在的目录-->
<developerConnection>scm:svn:svn://pub.ipay.sina.com/sina-pay-center/project/wallet/30.sourcecode/trunk</developerConnection>
</scm>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-release-plugin</artifactId>
<version>2.0-beta-7</version>
<configuration>
<tagNameFormat>v@{project.version}</tagNameFormat>
<!-- 指定tag目录, 如果是svn的默认结构, 可以省略-->
<tagBase>svn://pub.ipay.sina.com/sina-pay-center/core/biz-modules/20.code/tags/account-wallet</tagBase>
</configuration>
</plugin>

</plugins>
</build>

一次正式的发布需要这样一些工作:

  1. 在trunk中,更新pom版本从1.0-SNAPSHOT到1.0
  2. 对1.0打一个svn tag
  3. 针对tag进行mvn deploy,发布正式版本
  4. 更新trunk从1.0到1.1-SNAPSHOT

如下命令帮助我们完成这些工作

# 打一个快照版本并上传到SVN的tag目录,并且项目的版本会改变
mvn release:clean release:prepare -Darguments="-Dmaven.test.skip=true -Dmaven.javadoc.skip=true"

# Perform a release from SCM, either from a specified tag, or the tag representing the
# previous release in the working copy created by release:prepare
mvn release:perform -Darguments="-Dmaven.test.skip=true -Dmaven.javadoc.skip=true"

mvn release:rollback

4 release:preare

Preparing a release goes through the following release phases:

  1. Check that there are no uncommitted changes in the sources
  2. Check that there are no SNAPSHOT dependencies
  3. Change the version in the POMs from x-SNAPSHOT to a new version (you will be prompted for the versions to use)
  4. Transform the SCM information in the POM to include the final destination of the tag
  5. Run the project tests against the modified POMs to confirm everything is in working order
  6. Commit the modified POMs
  7. Tag the code in the SCM with a version name (this will be prompted for)
  8. Bump the version in the POMs to a new value y-SNAPSHOT (these values will also be prompted for)
  9. Commit the modified POMs

5 release:rollback

When a release is rolled back, the following release phases are executed:

  1. All project POMs are reverted back to their pre-release state locally, and also in the SCM if the previous release command was able to successfully make changes in the SCM to the POMs.This is done by using the backup files created during release:prepare.
  2. The created branch/tag in SCM for the release is removed. Note: This is not yet implemented so you will need to manually remove the branch/tag from your SCM. For more info see MRELEASE-229.