getClass().getClassLoader().getPackage("").getImplementationVersion()
On 11 January 2012 16:44, Steve Cohen <sco...@javactivity.org> wrote: >>> Hm, is this really heading into the direction you intended with your > question originally? > > No, it isn't! Thanks. The original link I posted talked about reading the > manifest with a dead link explaining this in more detail. Another poster > set me off on this blind alley. > > I think 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 <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 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 development. > > If you have in mind some kind of application that just happens to use > maven as a build platform, > then the solution is not in the first place maven specific. > (The version of the maven project needs not necessarily be the version > of the application, > but providing such info to your application is application specif in the > first place.) > > You need to consider in what form said information is to be bundled with > your application. > (e.g. readable from jar manifest or other resource, read from pom > included with jar, provided by a dedicated class to name a few) > Second step would be how you access it from there. > > So, probably you can drop a word or more on the use case involved. > > Rainer > > On 11.01.2012 16:07, 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 version of the interface/impl REMOVE the >> getApplicationVersion() method. >> >> What's going on here and what is the approved method for getting the >> application version now? >> >> >> On 01/11/2012 08:59 AM, Steve Cohen wrote: >>> >>> 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 dependency on Maven itself within >>> the application. What jar would this be? >>> >>> Thanks again. >>> >>> On 01/11/2012 08:12 AM, Guillaume Polet wrote: >>>> >>>> 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 this question appears to have been offered here, in >>>>> 2007. >>>>> >>>>> >>>>> http://maven.40175.n5.nabble.com/HowTo-access-project-version-programmatically-in-application-td82542.html >>>>> >>>>> >>>>> >>>>> >>>>> It references a page explaining how to do it. That page is now gone: >>>>> >>>>> >>>>> http://svn.apache.org/repos/asf/maven/components/trunk/maven-core/src/main/java/org/apache/maven/execution/DefaultRuntimeInformation.java >>>>> >>>>> >>>>> >>>>> >>>>> Does this page or another more advanced way to do this now exist? >>>>> >>>>> Thanks. >>>>> >> >> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org >> For additional commands, e-mail: users-h...@maven.apache.org >> > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: users-unsubscr...@maven.apache.org > For additional commands, e-mail: users-h...@maven.apache.org > --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscr...@maven.apache.org For additional commands, e-mail: users-h...@maven.apache.org