Re: Howto access project version programmatically within application

2012-01-11 Thread Jeff Jensen
M >> To: users@maven.apache.org >> 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'

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. (Thi

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 Matt Walsh
012 11:10 AM > To: users@maven.apache.org > 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(&quo

Re: Howto access project version programmatically within application

2012-01-11 Thread Rainer Pruy
n-Version")); 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 proj

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 unsubsc

Re: Howto access project version programmatically within application

2012-01-11 Thread Steve Cohen
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("")

RE: Howto access project version programmatically within application

2012-01-11 Thread Matt Walsh
ot; + atts.getValue("Implementation-Version")); 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@

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: Package.getPackage("").get

Re: Re: Howto access project version programmatically within application

2012-01-11 Thread Stephen Connolly
> ---- Original Message > Subject: Re: Howto access project version programmatically within > application > Date: Wed, 11 Jan 2012 16:41:49 +0100 > From: Rainer Pruy > Reply-To: Maven Users List > Organization: Acrys Consult GmbH & Co. KG > To: users@mave

Fwd: Re: Howto access project version programmatically within application

2012-01-11 Thread Steve Cohen
k I need 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 Repl

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,

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

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() met

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 dependen

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 th