mvn release configuration instructions

mvn release configuration instructions

 

1. Configure setting.xml

Add server in setting.xml

my-scm-server , the corresponding username and password are the username and password of git

 <server>

           <id>my-scm-server</id>  

             <username>******</username>  

              <password>******</password>  

           </server>  

2. Configure pom.xml in this project

<!--[if !supportLists]--> 1)  <!--[endif]-->The local development version must be a snapshot version

  <version>0.0.1-SNAPSHOT</version>

<!--[if !supportLists]--> 2)  <!--[endif]--> - Configure project.scm.id to correspond to my-scm-server in the setting file

 

<project.scm.id>my-scm-server</project.scm.id>

 

<!--[if !supportLists]-->3) <!--[endif]-->scm配置

 

<!-- Configure code git path -->

<scm>

<connection>scm:git:https://git.coding.net/******/common.settlement.sdk.git</connection>

<url>https://git.coding.net/******/common.settlement.sdk.git</url>

<developerConnection>scm:git:https://git.coding.net/******/common.settlement.sdk.git</developerConnection>

<tag>1</tag>

</scm>

 

<!--[if !supportLists]--> 4)  <!--[endif]--> Add maven-release-plugin plugin

<plugins>

 

<!-- Publish source code to nexus -->

<plugin>

<artifactId>maven-source-plugin</artifactId>

<version>2.1</version>

<configuration>

<attach>true</attach>

</configuration>

<executions>

<execution>

<phase>compile</phase>

<goals>

<goal>jar</goal>

</goals>

</execution>

</executions>

</plugin>

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-javadoc-plugin</artifactId>

<configuration>

<additionalparam>-Xdoclint:none</additionalparam>

</configuration>

</plugin>

<plugin>

<groupId>org.apache.maven.plugins</groupId>

<artifactId>maven-release-plugin</artifactId>

<version>2.5.3</version>

<configuration>

<tagNameFormat>v@{project.version}</tagNameFormat>

<autoVersionSubmodules>true</autoVersionSubmodules>

<releaseProfiles>releases</releaseProfiles>

</configuration>

</plugin>

<plugin>

<groupId>org.sonatype.plugins</groupId>

<artifactId>nexus-staging-maven-plugin</artifactId>

<version>1.5.1</version>

<executions>

<execution>

<id>default-deploy</id>

<phase>deploy</phase>

<goals>

<goal>deploy</goal>

</goals>

</execution>

</executions>

<configuration>

<serverId>nexus</serverId>

<nexusUrl>http://api.******.com/nexus/</nexusUrl>

<skipStaging>true</skipStaging>

</configuration>

</plugin>

</plugins>

<!--[if !supportLists]-->5) <!--[endif]-->增加部署配置

<distributionManagement>

<repository>

<id>releases</id>

<url>http://api.*****.com/nexus/content/repositories/releases</url>

</repository>

</distributionManagement>

 

3、命令执行

<!--[if !supportLists]-->1)<!--[endif]-->登陆 115.28.58.**

<!--[if !supportLists]-->2)<!--[endif]-->把代码clone到服务器

如果代码在主干上,直接clone主干

git clone https://username:password@git.coding.net/******/common.settlement.sdk.git

分支的需要clone分支

git clone -b test https://username:password@git.coding.net/******/common.settlement.sdk.git

3)clone的目录下执行 release 命令

 mvn release:clean release:prepare release:perform

maven-release-plugin会自动帮我们签出刚才打的tag,然后打包,分发到远程Maven仓库中,至此,整个版本的升级,打标签,发布等工作全部完成。我们可以在远程Maven仓库中看到正式发布的1.0版本。

 

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326979620&siteId=291194637