jeudi 1 mai 2014

Numéro de version change dynamiquement lors de build avec maven - Stack Overflow


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.


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. Any ideas ?




I think you can just append your buildNumber variables to your version property:


<version>1.2.${buildNumber0}${buildNumber1}${buildNumber2}-SNAPSHOT</version>


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.


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. Any ideas ?



I think you can just append your buildNumber variables to your version property:


<version>1.2.${buildNumber0}${buildNumber1}${buildNumber2}-SNAPSHOT</version>

0 commentaires:

Enregistrer un commentaire