Re: Howto access project version programmatically within application

2012-01-11 Thread Guillaume Polet
Just google org/apache/maven/execution/DefaultRuntimeInformation.java . http://grepcode.com/file/repo1.maven.org/maven2/org.apache.maven/maven-core/2.0.5/org/apache/maven/execution/DefaultRuntimeInformation.java?av=h Cheers, Guillaume Le 11/01/2012 15:03, Steve Cohen a écrit : A solution to

Re: Howto access project version programmatically within application

2012-01-11 Thread Steve Cohen
Thanks. But according to this: http://maven.apache.org/ref/3.0.4-SNAPSHOT/apidocs/org/apache/maven/execution/DefaultRuntimeInformation.html the getApplicationVersion() method has been deprecated, with no indication as to what I should use instead. Also, it seems that this introduces a

Re: Howto access project version programmatically within application

2012-01-11 Thread Steve Cohen
It appears that this entire class and the interface it is based on are deprecated, in favor of org.apache.maven.rtinfo.RuntimeInformation and org.apache.maven.rtinfo.internal.DefaultRuntimeInformation. But this non-deprecated version of the interface/impl REMOVE the getApplicationVersion()

Re: Howto access project version programmatically within application

2012-01-11 Thread Rainer Pruy
Hm, is this really heading into the direction you intended with your question originally? The api your are looking at is more for maven internal use (or for dealing with maven world (poms, etc.). If your application is into this direction you might find interesting hints with maven plugin

Re: Howto access project version programmatically within application

2012-01-11 Thread Mark H. Wood
On Wed, Jan 11, 2012 at 09:07:29AM -0600, Steve Cohen wrote: It appears that this entire class and the interface it is based on are deprecated, in favor of org.apache.maven.rtinfo.RuntimeInformation and org.apache.maven.rtinfo.internal.DefaultRuntimeInformation. But this non-deprecated

Re: Howto access project version programmatically within application

2012-01-11 Thread Matt Narrell
Agreed. I filter-copy a properties file with the following: project.name=${project.name} project.version=${project.version} build.date=${build.date} ... Then I can load this file and have at it. matt On Jan 11, 2012, at 7:48 AM, Mark H. Wood wrote: On Wed, Jan 11, 2012 at 09:07:29AM -0600,

Fwd: Re: Howto access project version programmatically within application

2012-01-11 Thread Steve Cohen
to roll my own manifest reader, since I AM encoding the version there, or perhaps read the maven.properties. Original Message Subject: Re: Howto access project version programmatically within application Date: Wed, 11 Jan 2012 16:41:49 +0100 From: Rainer Pruy rainer.p

Re: Re: Howto access project version programmatically within application

2012-01-11 Thread Stephen Connolly
: Howto access project version programmatically within application Date: Wed, 11 Jan 2012 16:41:49 +0100 From: Rainer Pruy rainer.p...@acrys.com Reply-To: Maven Users List users@maven.apache.org Organization: Acrys Consult GmbH Co. KG To: users@maven.apache.org Hm, is this really heading

Re: Howto access project version programmatically within application

2012-01-11 Thread Steve Cohen
On 01/11/2012 10:50 AM, Stephen Connolly wrote: getClass().getClassLoader().getPackage().getImplementationVersion() I really liked the simplicity of this idea. Alas, ClassLoader.getPackage(String) is a protected method, so this won't help. Accessible to me is:

RE: Howto access project version programmatically within application

2012-01-11 Thread Matt Walsh
)); System.out.println(Build: + atts.getValue(Implementation-Build)); -Original Message- From: Steve Cohen [mailto:sco...@javactivity.org] Sent: Wednesday, January 11, 2012 10:29 AM To: users@maven.apache.org Subject: Re: Howto access project version programmatically within application

Re: Howto access project version programmatically within application

2012-01-11 Thread Steve Cohen
@maven.apache.org Subject: Re: Howto access project version programmatically within application On 01/11/2012 10:50 AM, Stephen Connolly wrote: getClass().getClassLoader().getPackage().getImplementationVersion() I really liked the simplicity of this idea. Alas, ClassLoader.getPackage(String

Re: Howto access project version programmatically within application

2012-01-11 Thread Wayne Fay
getResourceAsStream(META_INF/MANIFEST.MF) and getResourceAsStream(/META_INF/MANIFEST.MF) without success even though I've verified that the file exists in the jar, Uhh that should be META-INF, right? Wayne - To unsubscribe,

Re: Howto access project version programmatically within application

2012-01-11 Thread Rainer Pruy
: Steve Cohen [mailto:sco...@javactivity.org] Sent: Wednesday, January 11, 2012 10:29 AM To: users@maven.apache.org Subject: Re: Howto access project version programmatically within application On 01/11/2012 10:50 AM, Stephen Connolly wrote: getClass().getClassLoader().getPackage

RE: Howto access project version programmatically within application

2012-01-11 Thread Matt Walsh
Subject: Re: Howto access project version programmatically within application Hmm, intriguing but not working in my case which is a jar, not a war or ear. This is standalone java app. I've tried getResourceAsStream(META_INF/MANIFEST.MF) and getResourceAsStream(/META_INF/MANIFEST.MF) without

Re: Howto access project version programmatically within application

2012-01-11 Thread Steve Cohen
On 01/11/2012 12:14 PM, Wayne Fay wrote: getResourceAsStream(META_INF/MANIFEST.MF) and getResourceAsStream(/META_INF/MANIFEST.MF) without success even though I've verified that the file exists in the jar, Uhh that should be META-INF, right? Wayne

Re: Howto access project version programmatically within application

2012-01-11 Thread Rainer Pruy
Looks like there are other jar (or classes directories) in classpath. getRessourceAsStream() will access the first entry (according to current classloader logic) and this need not be the one from the jar you are interested in. You might use getRessources() to get all candidates enumerated.

Re: Howto access project version programmatically within application

2012-01-11 Thread Jeff Jensen
- From: Steve Cohen [mailto:sco...@javactivity.org] Sent: Wednesday, January 11, 2012 10:29 AM To: users@maven.apache.org Subject: Re: Howto access project version programmatically within application On 01/11/2012 10:50 AM, Stephen Connolly wrote: getClass().getClassLoader().getPackage