我有一个 Maven pom.xml,我使用 Jenkins 在 Nexus 中构建项目和可执行 jar 部署。但我想根据分支名称更改版本名称。
例如:我在 pom.xml 中有
<groupId>net.test</groupId>
<artifactId>test-parent</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>iin-parent</name>
<packaging>pom</packaging>
Run Code Online (Sandbox Code Playgroud)
我需要这样设置:(分支-Master/Test1/Test2/..)
<groupId>net.test</groupId>
<artifactId>test-parent</artifactId>
<version>BranchName_0.0.1-SNAPSHOT</version>
<name>iin-parent</name>
<packaging>pom</packaging>
Run Code Online (Sandbox Code Playgroud)
如何才能做到这一点?
我正在使用 MVN 构建,如 -Drevision=BranchName-SNAPSHOT clean 编译包部署。但我想动态获取分支名称。
enter code here
Run Code Online (Sandbox Code Playgroud)