Hi Paul

Depending on what you need, this is not entirely trivial. If you just want to set property 'foo' to value 'bar', then the approach below is just fine. But say you have a property 'baz' in your pom like this:
<properties>
  <baz>xx${foo}xx</baz>
</properties>

And you want 'baz' to evaluate to 'xxbarxx', then you need a bit more logic in your Mojo. As is described here => http://plexus.codehaus.org/plexus-interpolation/


Greetings,
 Thomas

Paul wrote:
Le mercredi 11 mars 2009 19:24:20, Nord, James a écrit :
The following will set a variable I_WAS_HERE to "true".

Thanks, that's what I was looking for.
Simple :)

Paul


/**
 * 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");
        }

}



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to