Hi Stephen,
Can you elaborate on your response?
I'm trying to figure out the Mojo annotations so that the field 
deliverableSettingsBaseDir is injected with an expression of:
 <value of the "basedir" property> concatenated with a constant value 
"/settings.xconfig".

Thanks
Roger



-----Original Message-----
From: Stephen Connolly [mailto:stephen.alan.conno...@gmail.com] 
Sent: Thursday, January 17, 2013 11:04 AM
To: Maven Users List
Subject: Re: How to specify an expression for a Mojo annotation parameter in 
Maven 3?

That is really a default value not an expression


On 17 January 2013 17:01, Huang, Roger <roghu...@paypal.com> wrote:

>
> Is there a way to specify an expression for the Mojo annotation 
> @parameter in Maven 3?
>
> I have a Mojo, GenerateConfigMojo.java, with property 
> "deliverableSettings" of type java.io.File.
> Here is the original GenerateConfigMojo.java, built w/ Maven 2.2.1:
>
> /**
> * Goal which touches a timestamp file.
> *
>  * @goal generate-config
> * @phase generate-resources
> */
> public class GenerateConfigMojo extends AbstractMojo {
>
> <snip>
>         /**
>         * @parameter expression="${basedir}/settings.xconfig"
>         * @required
>         */
>         private File deliverableSettings;
>
> When I build this with Maven 3.0.4, I get this WARNING:
>
> [WARNING]
> com.paypal.maven.plugins.deliverable.GenerateConfigMojo#deliverableSettings:^M
> [WARNING]   The syntax^M
> [WARNING]     @parameter expression="${property}"^M
> [WARNING]   is deprecated, please use^M
> [WARNING]     @parameter property="property"^M
> [WARNING]   instead.^M
>
> My current solution is to set the expression value in the Java code.
> I changed the Java 5 annotation to
>
> /**
> * Goal which touches a timestamp file.
> *
>  * @goal generate-config
> * @phase generate-resources
> */
> public class GenerateConfigMojo extends AbstractMojo {
>
> <snip>
>                 /**
>                 * @parameter property="basedir"
>                 * @required
>                 */
>                 private File deliverableSettingsBaseDir;
>
> <snip>
>
>        this.deliverableSettings = new File(
> this.deliverableSettingsBaseDir.getPath() + "/settings.xconfig");
>
> Is there a way to still specify the expression via annotations?
>
> Thanks,
> Roger
>
>

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

Reply via email to