I generate a build-number with this part of the POM file:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<version>1.2</version>
<configuration>
<buildNumberPropertyName>project.build.number</buildNumberPropertyName>
<timestampPropertyName>project.build.time</timestampPropertyName>
<format>{0,date,yyyyMMddHHmmss}</format>
<items>
<item>timestamp</item>
</items>
<doCheck>false</doCheck>
<doUpdate>false</doUpdate>
</configuration>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
</plugin>
After that i set the finalName to following:
<finalName>
${project.artifactId}-${project.version}.${project.build.number}
</finalName>
I'm also using the webstart-maven-plugin to generate the project as webstart-app. The webstart-plugin generates a zip-file. And that all works fine except for one little detail:
On build there is this output:
[buildnumber:create]
Storing buildNumber: 20130312133207 at timestamp: 1363091527664
Building jar: D:\projects\myProject\target\myProject-1.0.20130312133207.jar
Building jar: D:\projects\myProject\target\myProject-1.0.20130312133207-sources.jar
Building jar: D:\projects\myProject\target\myProject-1.0.20130312133207-javadoc.jar
Building zip: D:\projects\myProject\target\myProject-1.0.${project.build.number}.zip
Why isn't the ${project.build.number} replaced in the zip-file? Is it because it is zip and not jar? Why is the version replaced then? How can i tell the POM to replace the buildNumber in the zip-file?
I already tried using the default $buildNumber instead of the $project.build.number, that also doesn't work.
Edit: I already tried different phases for the two plugins, but no combination worked so far.
Edit2: In case it is interesting for you, how the Webstart-Plugin-part looks like, here is the code:
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>webstart-maven-plugin</artifactId>
<version>1.0-beta-3</version>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>jnlp</goal>
</goals>
</execution>
</executions>
<configuration>
<!-- JNLP generation -->
<jnlp>
<!-- default values -->
<inputTemplateResourcePath>${project.basedir}</inputTemplateResourcePath>
<inputTemplate>src/main/jnlp/app.vm</inputTemplate> <!-- relative to inputTemplateResourcePath -->
<outputFile>app.jnlp</outputFile> <!-- defaults to launch.jnlp -->
<!-- used to automatically identify the jar containing the main class. -->
<!-- this is perhaps going to change -->
<mainClass>com.mycompany.myproject.App</mainClass>
</jnlp>
<sign>
<keystore>${basedir}/keystore</keystore>
<keypass>password</keypass> <!-- we need to override passwords easily from the command line. ${keypass} -->
<storepass>password</storepass> <!-- ${storepass} -->
<!--storetype>fillme</storetype-->
<alias>MyProjectWebstart</alias>
<!--validity>fillme</validity-->
<!-- only required for generating the keystore -->
<dnameCn>MyProjectWebstart</dnameCn>
<dnameOu>MyName</dnameOu>
<dnameO>MyCompany</dnameO>
<dnameL>MyTown</dnameL>
<dnameSt>MyState</dnameSt>
<dnameC>MyCountry</dnameC>
<verify>true</verify> <!-- verify that the signing operation succeeded -->
<!-- KEYSTORE MANAGEMENT -->
<keystoreConfig>
<delete>true</delete> <!-- delete the keystore -->
<gen>true</gen> <!-- optional shortcut to generate the store. -->
</keystoreConfig>
</sign>
</configuration>
</plugin>
I used the code in the example there: Looking for Webstart Maven Plugin sample application