Thanks a lot!

I have tried this method. But I have another problem:

I declare the mojo in root pom.xml and the property added in mojo can be
reference with ${propertyName}. But in the pom.xml of sub module, the
property can't be referenced like this. It seems no such property added in
mojo.

What's the reason? Is there any solution?


Stephen Connolly-2 wrote:
> 
> 2009/1/16 Carlo Sciolla <carlo.scio...@gmail.com>
> 
>> Something like this:
>>
>> <code>
>> // MyMojo.java
>>
>>    /**
>>    * The Maven project
>>    * @parameter expression="${project}"
>>    * @required
>>    */
>>    private MavenProject project;
>>
>> [...]
>>
>>    public void execute()
>>        throws MojoExecutionException
>>    {
>> [...]
>>        project.getProperties().put("propertyAvailableHereafter",
>> actualValue);
>> [...]
>>    }
>> }
>> </code>
>>
> 
> But note that this property will only be available to phases after your
> mojo
> has executed....
> 
> This can cause fun if you want to use the property value in the pom in an
> expression that is used when the initial model is being constructed (i.e.
> you cannot use the property in /project/artifactId, etc)
> 
> 
>>
>>
>> Hope this helps,
>> c.
>>
>> --
>> Carlo Sciolla - http://www.skuro.tk
>> Software Engineer at Sourcesense - Making sense of open Source
>> (http://www.sourcesense.com)
>> Linux User #372086
>>
>>  \|/
>>  -(o< -- I'm a punk, dude!
>>  //\
>>  V_/_
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
>> For additional commands, e-mail: users-h...@maven.apache.org
>>
>>
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-update-property-value-of-POM.xml-in-a-maven-plugin--tp21492944p21558582.html
Sent from the Maven - Users mailing list archive at Nabble.com.


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

Reply via email to