When Maven builds a jar, it writes a file named pom.properties to:
/META-INF/maven///pom.properties
It looks like this:
#Generated by Maven
#Thu Sep 13 15:43:41 PDT 2007
version=2.0
groupId=org.apache.maven.plugins
artifactId=maven-ant-plugin
You can just read this file directly to access the version, using
ClassLoader.getResourceAsStream().
Wayne
On 1/12/08, Chris <[EMAIL PROTECTED]> wrote:
> My app needs to know its version at runtime (so it can log it). I could
> just hardcode the version into one of the classes, but I'm concerned
> that the hardcoded version could get out of sync with the tag
> in the pom file.
>
> Is there a way for Maven to write the in the pom into a class
> at build time? Or conversely, get the version out of a class at build
> time? (The latter would be better).
>
> What's the most maven-ish way to handle this problem?
>
>
> -
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]