Search code examples
javabuildcompile-timeunique-idbuildnumber-maven-plugin

Obtaining the Build ID in a Java Application


Does anyone have a simple suggestion for recording a build ID (generated at compile time) which is displayed in the title bar of the app at runtime?

Building from within Eclipse, all I need is the ID, I can then pass it up to the title.


Solution

  • If you are using Ant, you can easily set up your "jar" or "package" target so that it generates a file including the current timestamp and include this in your jar output.

    If using Maven, there are a few ways to achieve something similar, such as dropping down to Ant using the antrun plugin.