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).

Yes, this is only generated when the JAR is packaged. It might be best
for your test cases to substitute in a known value here rather than
relying on it, unless you are doing something specific with the
version.

>
> 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…

@project.version@ should be substituted in a copy, but resources are
processed after compilation so the timing is not correct. You'd need
to execute a specific plugin in the generate-sources phase.

- Brett

>
> Any help would be most gratefully appreciated.
>
> Thanks,
> -Dom



-- 
Brett Porter
Blog: http://blogs.exist.com/bporter/

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

Reply via email to