[英]change version number dynamically when build with maven
Instead of changing the version manually, is there any way to update it with the build number? 无需手动更改版本,有什么办法可以使用内部版本号对其进行更新?
<version>1.2.132-SNAPSHOT</version>
In the above code, I need the build number instead of 132. 在上面的代码中,我需要内部版本号而不是132。
I've used the following code to generate the build number. 我使用以下代码生成内部版本号。
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.0</version>
<configuration>
<format>{0,number}.{1,number}.{2,number}</format>
<items>
<item>buildNumber0</item>
<item>buildNumber1</item>
<item>buildNumber2</item>
</items>
</configuration>
<executions>
<execution>
<phase>initialize</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
</plugin>
And I need the build number just before -SNAPSHOT. 我需要在-SNAPSHOT之前的内部版本号。 Any ideas ?
有任何想法吗 ?
我认为您可以将buildNumber变量附加到version属性:
<version>1.2.${buildNumber0}${buildNumber1}${buildNumber2}-SNAPSHOT</version>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.