taverna-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stian Soiland-Reyes <st...@apache.org>
Subject Re: Version
Date Wed, 19 Aug 2015 23:58:23 GMT
Yes, I saw this.

The best would be if you could pick up the version from the Maven pom
file.. so it is auto-updated, e.g. it would be
0.15.1-incubating-SNAPSHOT now.

I remember a way to do this with generating a special resource file in
Maven that you then read from inside.. but I think now you can do it
easier by using something like
getClass().getResource("/org.apache.taverna.language/taverna-language-commandline/pom.properties")
and read it as a java.util.Properties file

stain@biggie:~/src/taverna/incubator-taverna-language/taverna-language-commandline/target/1$
cat META-INF/maven/org.apache.taverna.language/taverna-language-commandline/pom.properties
#Generated by Maven
#Thu Aug 20 00:31:04 BST 2015
version=0.15.1-incubating-SNAPSHOT
groupId=org.apache.taverna.language
artifactId=taverna-language-commandline

This would however be fragile to the hardcoded Maven groupId and
artifactId that is part of the path.


Alternatively I think you can use the fact that every Taverna JAR is a
bundle, and read the META-INF/MANIFEST.MF for your package:

Implementation-Title: Apache Taverna Language Commandline
Implementation-Version: 0.15.1-incubating-SNAPSHOT

which I think you can access with something like


            System.out.print(getClass().getPackage().getImplementationTitle());
            System.out.println(" " +
getClass().getPackage().getImplementationVersion());


Now if this works, this is probably the neatest.. but you would have
to check if that would still give the right result within the shaded
JAR which might mangle that META-INF/maven file.




On 20 August 2015 at 00:42, Menaka Madushanka <menaka12350@gmail.com> wrote:
> Hello Stian,
> I have asked this before also... about showing the version (tavlang version)
> I used a format like this.
>     Apache Taverna Language Commandline tool
>     Version 1.0
>
> I know this is not appropriate. So what would be in the version information?
> Is it 0.15.1?
>
> Cheers
> Menaka
>
> --
> Menaka Madushanka Jayawardena
> Faculty of Engineering,
> University of Peradeniyaya.
> LinkedIn



-- 
Stian Soiland-Reyes
Apache Taverna (incubating), Apache Commons RDF (incubating)
http://orcid.org/0000-0001-9842-9718

Mime
View raw message