[EMAIL PROTECTED] wrote on Monday, December 06, 2004 11:09 AM:

> Hi all,
> 
> I have a mavenised application, whose version number is contained in
> project.xml. 
> 
> I would like the app to build such that when you run "app
> --version", it gives the version number as specified in the
> pom when the program was built.
> 
> What is the best practise way to do this?

I'll do this getting the value from the generated manifest. I build my app with 
the javaapp plugin (see maven-plugins.sf.net) and you can access the values 
with something like:

    public static void main(String[] args) {
        Package pkg = Manifest.class.getPackage();
        String specVersion = pkg.getSpecificationVersion();
        String implVersion = pkg.getImplementationVersion();
    }

Note, that the specification version is currently not available using the jar 
plugin of Maven, this is fixed in the javaapp plugin. Additionally this works 
only, if the classes are really loaded from the jar. Using this code from 
within an IDE or a unit test it will fail.

- J�rg

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

Reply via email to