The following will set a variable I_WAS_HERE to "true". /** * Goal which stores some properties * * @goal getProperty * @phase validate */ The following gets the maven version and stores it as the maven.version property.
public class MavenPropertiesMojo extends AbstractMojo { /** * The Maven project. * * @parameter expression="${project}" * @required * @readonly */ private MavenProject project; /** * @component */ private RuntimeInformation runtime; public void execute() throws MojoExecutionException { project.getProperties().put("I_WAS_HERE", "true"); } } > -----Original Message----- > From: Paul [mailto:p...@nosphere.org] > Sent: 11 March 2009 18:03 > To: Maven Developers List > Subject: How to set build properties from a Mojo > > I need to write a mojo that reads some data and makes it > available in the pom as ${properties}. > > Is there a way to achieve this ? > > > ************************************************************************************** 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