You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by Sachin Patel <sp...@gmail.com> on 2006/02/22 19:41:11 UTC
Setting pom properties in mojo
How can I set a property in a mojo so that it is accessible in a pom?
For example I have a dependency...
<dependency>
<groupId>eclipse</groupId>
<artifactId>org.eclipse.wst.server.core</artifactId>
<version>${version}</version>
</dependency>
I have a mojo that needs to dynamically set the versions of my
dependencies so I tried adding...
/**
* @parameter expression="${project}"
* @required
* @readonly
*/
private MavenProject project;
and the setting the version property like so..
project.getProperties().put("version", "1.0.0");
But when the compile phase ran, the ${version} property did not
resolve. Any ideas what I'm doing wrong?
Thanks.
- sachin
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Setting pom properties in mojo
Posted by Sachin Patel <sp...@gmail.com>.
Nope that didn't work.
- sachin
On Feb 22, 2006, at 6:27 PM, Alexandre Poitras wrote:
> I have no idea if it has something to do with it but have you tried to
> get ride of the @readonly annotations on the project property?
>
> On 2/22/06, Sachin Patel <sp...@gmail.com> wrote:
>> How can I set a property in a mojo so that it is accessible in a pom?
>>
>> For example I have a dependency...
>>
>> <dependency>
>> <groupId>eclipse</groupId>
>> <artifactId>org.eclipse.wst.server.core</artifactId>
>> <version>${version}</version>
>> </dependency>
>>
>> I have a mojo that needs to dynamically set the versions of my
>> dependencies so I tried adding...
>>
>> /**
>> * @parameter expression="${project}"
>> * @required
>> * @readonly
>> */
>> private MavenProject project;
>>
>> and the setting the version property like so..
>>
>> project.getProperties().put("version", "1.0.0");
>>
>> But when the compile phase ran, the ${version} property did not
>> resolve. Any ideas what I'm doing wrong?
>>
>> Thanks.
>>
>> - sachin
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
>> For additional commands, e-mail: users-help@maven.apache.org
>>
>>
>
>
> --
> Alexandre Poitras
> Québec, Canada
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: Setting pom properties in mojo
Posted by Alexandre Poitras <al...@gmail.com>.
I have no idea if it has something to do with it but have you tried to
get ride of the @readonly annotations on the project property?
On 2/22/06, Sachin Patel <sp...@gmail.com> wrote:
> How can I set a property in a mojo so that it is accessible in a pom?
>
> For example I have a dependency...
>
> <dependency>
> <groupId>eclipse</groupId>
> <artifactId>org.eclipse.wst.server.core</artifactId>
> <version>${version}</version>
> </dependency>
>
> I have a mojo that needs to dynamically set the versions of my
> dependencies so I tried adding...
>
> /**
> * @parameter expression="${project}"
> * @required
> * @readonly
> */
> private MavenProject project;
>
> and the setting the version property like so..
>
> project.getProperties().put("version", "1.0.0");
>
> But when the compile phase ran, the ${version} property did not
> resolve. Any ideas what I'm doing wrong?
>
> Thanks.
>
> - sachin
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
--
Alexandre Poitras
Québec, Canada
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org