Re: How to retrieve the current maven version from a plugin?

2009-10-22 Thread Mark Hobson
2009/10/22 Brett Porter br...@apache.org: Well, there's maven-runtime in shared, but that stack dumps on M3 (not sure if that's a regression or known incompat.) Code like this:  try {    System.out.println( runtime.getProject( Mojo.class ).getVersion() ); } catch ( MavenRuntimeException e

Re: How to retrieve the current maven version from a plugin?

2009-10-21 Thread Stephen Connolly
OK, Benjamin I have been brainstorming: 17:45 SteveC what about new JarFile( new File( System.getProperty(maven.home), lib/whatever jars are here ) ).getManifest() and look for the implementation version corresponding to the Maven Distribution Implementation Title 17:46 bentmann

Re: How to retrieve the current maven version from a plugin?

2009-10-21 Thread Hervé BOUTEMY
what about MavenProject.class.getPackage().getImplementationVersion()? regards, Hervé Le mercredi 21 octobre 2009, Stephen Connolly a écrit : OK, Benjamin I have been brainstorming: 17:45 SteveC what about new JarFile( new File( System.getProperty(maven.home), lib/whatever jars are here )

Re: How to retrieve the current maven version from a plugin?

2009-10-21 Thread Benjamin Bentmann
Hervé BOUTEMY schrieb: what about MavenProject.class.getPackage().getImplementationVersion()? That could be a good additional check because of its simplicity and different data source. I wouldn't suggest to make it the only check because of [0]: Null is returned if no package object was

Re: How to retrieve the current maven version from a plugin?

2009-10-21 Thread Stephen Connolly
Sent from my [rhymes with tryPod] ;-) On 21 Oct 2009, at 22:23, Benjamin Bentmann benjamin.bentm...@udo.edu wrote: Hervé BOUTEMY schrieb: what about MavenProject.class.getPackage().getImplementationVersion ()? That could be a good additional check because of its simplicity and

Re: How to retrieve the current maven version from a plugin?

2009-10-21 Thread Brian Fox
What was wrong with the RuntimeInformation that was present in M2? There should be one canonical interface to get the version of Maven that everyone uses. The implementation behind that may implement some of these suggestions, but I wouldn't want to see this in every plugin that cares. On Wed,

Re: How to retrieve the current maven version from a plugin?

2009-10-21 Thread Benjamin Bentmann
Brian Fox wrote: What was wrong with the RuntimeInformation that was present in M2? It was put in maven-compat and deprecated in M3 so we were looking for alternatives. Benjamin - To unsubscribe, e-mail:

Re: How to retrieve the current maven version from a plugin?

2009-10-21 Thread Brian Fox
On Wed, Oct 21, 2009 at 7:08 PM, Benjamin Bentmann benjamin.bentm...@udo.edu wrote: Brian Fox wrote: What was wrong with the RuntimeInformation that was present in M2? It was put in maven-compat and deprecated in M3 so we were looking for alternatives. Yeah, but why? Benjamin

Re: How to retrieve the current maven version from a plugin?

2009-10-21 Thread Stephen Connolly
2009/10/22 Brian Fox bri...@infinity.nu On Wed, Oct 21, 2009 at 7:08 PM, Benjamin Bentmann benjamin.bentm...@udo.edu wrote: Brian Fox wrote: What was wrong with the RuntimeInformation that was present in M2? It was put in maven-compat and deprecated in M3 so we were looking for

Re: How to retrieve the current maven version from a plugin?

2009-10-21 Thread Brett Porter
Well, there's maven-runtime in shared, but that stack dumps on M3 (not sure if that's a regression or known incompat.) Code like this: try { System.out.println( runtime.getProject( Mojo.class ).getVersion () ); } catch ( MavenRuntimeException e ) { throw new MojoExecutionException(

Re: How to retrieve the current maven version from a plugin?

2009-10-21 Thread Brian Fox
On Wed, Oct 21, 2009 at 7:15 PM, Stephen Connolly stephen.alan.conno...@gmail.com wrote: 2009/10/22 Brian Fox bri...@infinity.nu On Wed, Oct 21, 2009 at 7:08 PM, Benjamin Bentmann benjamin.bentm...@udo.edu wrote: Brian Fox wrote: What was wrong with the RuntimeInformation that was

Re: How to retrieve the current maven version from a plugin?

2009-10-21 Thread Stephen Connolly
2009/10/22 Brian Fox bri...@infinity.nu On Wed, Oct 21, 2009 at 7:15 PM, Stephen Connolly stephen.alan.conno...@gmail.com wrote: 2009/10/22 Brian Fox bri...@infinity.nu On Wed, Oct 21, 2009 at 7:08 PM, Benjamin Bentmann benjamin.bentm...@udo.edu wrote: Brian Fox wrote: What was

How to retrieve the current maven version from a plugin?

2009-10-20 Thread Stephen Connolly
What is the recommended way to retrieve the current Maven version from within a plugin? Use case: I want to add a maven version selector to maven-invoker-plugin. Thus invoker tests which are for 3.x features only will not even try to run on 2.x, and we can keep the same suite of tests. I was