2008/9/29 Dominic Mitchell <[EMAIL PROTECTED]>:
> What's the easiest way to get at the version number in the POM from Java?
>
> I've been using
> getResourceAsStream('META-INF/maven/groupId/artifactId/pom.properties');
>  But this doesn't work while I'm developing in Eclipse (only when using the
> built jar file).
>
> Ideally, I'd like to somehow generate a Java class which contains the
> version number.  I thought I should be able to do this using resource
> filtering, but I couldn't see a way to configure the resources plugin to
> achieve this…
>
> Any help would be most gratefully appreciated.

You can use maven-runtime to dynamically obtain this information, but
it still has the limitation of requiring the META-INF files created at
package-time:

http://maven.apache.org/shared/maven-runtime/

I'd quite like to see the generation of these metadata files occur at
the generate-resources phase of the lifecycle which would allow it
work within the IDE too.

Cheers,

Mark

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to