What would be the solution for Maven 3? I currently have a plug-in that
does exactly what you describe.

/**
 * Goal which stores the maven core version in a property
<code>maven.version</code>.
 * 
 * @goal getVersion
 * @phase validate
 * @author James Nord
 */
public class MavenVersionMojo extends AbstractMojo {

        private final static String VERSION_PROPERTY = "maven.version";

        /**
         * The Maven project.
         * 
         * @parameter expression="${project}"
         * @required
         * @readonly
         */
        private MavenProject        project;

        /**
         * @component
         */
        private RuntimeInformation  runtime;


        public void execute() throws MojoExecutionException {
                ArtifactVersion mavenVersion =
runtime.getApplicationVersion();
                getLog().debug("retrieved maven version: " +
mavenVersion.toString());
                if (project != null) {
                        project.getProperties().put(VERSION_PROPERTY,
mavenVersion.toString());
                }
        }
        
}
 

> -----Original Message-----
> From: Brett Porter [mailto:br...@apache.org] 
> Sent: 25 March 2009 23:29
> To: Maven Developers List
> Subject: Re: Recording build environment
> 
> I don't think so, but you can get your hands on the 
> RuntimeInformation.ROLE component. Bear in mind it will 
> almost certainly cause your plugin to get broken in Maven 3.0 though.
> 
> - Brett
> 
> On 26/03/2009, at 6:20 AM, Paul Gier wrote:
> 
> > That's true, I can get the OS and Java version from standard 
> > properties, and then put them in the Manifest or somewhere 
> else.  Is 
> > there a property that contains the current running version of maven?
> >
> > Brian E. Fox wrote:
> >> It seems like if there were some properties available, or known to 
> >> the resources plugin, then you could filter these values 
> in anywhere 
> >> you wanted them.
> >> -----Original Message-----
> >> From: Paul Gier [mailto:pg...@redhat.com] Sent: Wednesday, 
> March 25, 
> >> 2009 11:54 AM
> >> To: Maven Developers List
> >> Subject: Recording build environment
> >> I'd like to be able to record the build environment (maven 
> version, 
> >> java, OS, etc) for each build that is run in a standard way.  I 
> >> originally created a jira issue in the release plugin 
> (MRELEASE-352) 
> >> to record information just for releases.  But now I'm 
> thinking that 
> >> this could be useful for any build.
> >> I'd just like to get a few other opinions about this 
> before working 
> >> on it.  Is there any existing plugin that might be a good fit for 
> >> this type of functionality?  Or should it be a new plugin? 
>  Or would 
> >> this type of thing be better handled by something like Hudson?
> >> Thanks!
> >> 
> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org For 
> >> additional commands, e-mail: dev-h...@maven.apache.org
> >> 
> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org For 
> >> additional commands, e-mail: dev-h...@maven.apache.org
> >
> >
> > 
> ---------------------------------------------------------------------
> > To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org For 
> > additional commands, e-mail: dev-h...@maven.apache.org
> >
> 
> --
> Brett Porter
> br...@apache.org
> http://blogs.exist.com/bporter/
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org For 
> additional commands, e-mail: dev-h...@maven.apache.org
> 
> 

**************************************************************************************
This e-mail is confidential, the property of NDS Ltd and intended for the 
addressee only. Any dissemination, copying or distribution of this message or 
any attachments by anyone other than the intended recipient is strictly 
prohibited. If you have received this message in error, please immediately 
notify the postmas...@nds.com and destroy the original message. Messages sent 
to and from NDS may be monitored. NDS cannot guarantee any message delivery 
method is secure or error-free. Information could be intercepted, corrupted, 
lost, destroyed, arrive late or incomplete, or contain viruses. We do not 
accept responsibility for any errors or omissions in this message and/or 
attachment that arise as a result of transmission. You should carry out your 
own virus checks before opening any attachment. Any views or opinions presented 
are solely those of the author and do not necessarily represent those of NDS.

To protect the environment please do not print this e-mail unless necessary.

NDS Limited Registered Office: One London Road, Staines, Middlesex, TW18 4EX, 
United Kingdom. A company registered in England and Wales Registered no. 
3080780 VAT no. GB 603 8808 40-00
**************************************************************************************

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@maven.apache.org
For additional commands, e-mail: dev-h...@maven.apache.org

Reply via email to