1. 將設定放入 project 的 pom.xml 中
<!-- 一定會用到的 release plugin -->
<plugin>
<groupid>org.apache.maven.plugins</groupid>
<artifactid>maven-release-plugin</artifactid>
<version>2.5</version>
<configuration>
<tagbase>https://.../svn/.../tags</tagbase>
</configuration>
</plugin>
<!-- 設定 deploy,沒有 server 測試時,可以放本機 -->
<distributionmanagement>
<repository>
<id>release</id>
<name>release</name>
<url>file://D:/release-jar</url>
</repository>
</distributionmanagement>
<!-- scm plugin 用到的,check in 及 check out 路徑等等 -->
<scm>
<url>scm:svn:https://.../svn/.../tags</url>
<connection>scm:svn:https:/.../svn/.../trunk/</connection>
<developerconnection>scm:svn:https://.../svn/.../trunk/</developerconnection>
</scm>
2. setting.xml 的設定檔案請放在 .../.m2/setting.xml
<pre class="brush: xml"><settings xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/SETTINGS/1.0.0" xsi:schemalocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<servers>
<server>
<id>release</id>
<username>hudson</username>
<password>hudson</password>
</server>
</servers>
</settings>
3. maven 指令username 跟 password 也可以不用指定,指定後要確定該帳號有 svn connection 的權限。
建議先試試: mvn -DdryRun=true release:prepare,如果檔案都沒問題再執行 release 動作。
mvn -Dusername=hudson -Dpassword=hudson release:clean release:prepare release:perform
Reference
Guide to using the release plugin
https://maven.apache.org/guides/mini/guide-releasing.html
Maven release plugin
http://maven.apache.org/maven-release/maven-release-plugin/
沒有留言:
張貼留言