You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@maven.apache.org by pjungwir <ma...@9stmaryrd.com> on 2006/10/13 04:21:29 UTC
properties in plugins vs. pom
Hello,
I'm developing a plugin in maven 2.0.4. My plugin has a property annotated
like this:
/**
* @parameter default-value="${artifactId}.exe"
*/
private File outfile;
When I use the plugin, outfile is set to "/home/pjungwir/src/encc/null.exe."
But suppose I use this javadoc instead:
/**
* @parameter default-value="${project.artifactId}.exe"
*/
private File outfile;
Now outfile is set correctly, to "/home/pjungwir/src/encc/encc.exe."
I thought this was strange, because when I use the antrun plugin, both of
these produce the correct result:
<execution>
<id>blah</id>
<phase>generate-sources</phase>
<goals><goal>run</goal></goals>
<configuration>
<tasks>
<echo message="${artifactId}"/>
<echo message="${project.artifactId}"/>
</tasks>
</configuration>
</execution>
When I run this, I see:
[INFO] Executing tasks
[echo] encc
[echo] encc
So why does ${artifactId} work in the pom, but not in the plugin javadoc? Do
maven variables have different names depending on context?
Thanks,
Paul
--
View this message in context: http://www.nabble.com/properties-in-plugins-vs.-pom-tf2434529.html#a6788751
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: properties in plugins vs. pom
Posted by pjungwir <ma...@9stmaryrd.com>.
dan tran wrote:
>
> when you are in pom.xml, ${someVar} means a reference of a variable under
> root of the pom
>
Ah, so within the pom, the "project." prefix is optional. It looks like it
is also optional when filtering resource files. But not when annotating
plugins. That's still a little annoying, but if it's a general rule, it's
not too hard to remember.
Thanks!
Paul
--
View this message in context: http://www.nabble.com/properties-in-plugins-vs.-pom-tf2434529.html#a6789254
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: properties in plugins vs. pom
Posted by Dan Tran <da...@gmail.com>.
I am wrong ;-)
when you are in pom.xml, ${someVar} means a reference of a variable under
root of the pom
However, maven also aware of other key vars such as ${project},
${settetings} etc.
Therefore
${project.artifactId} and ${artifactId} are the same thing
${basedir} ${project.basedir} are the same
I always start with ${project. ..
-D
On 10/12/06, pjungwir <ma...@9stmaryrd.com> wrote:
>
>
>
> dan tran wrote:
> >
> > inconsistency i guess, I suggest to always start with ${project....}
> >
>
> I'm surprised at the implication: different code handles variable
> replacement here vs. there.
>
> Inconsistencies like this can be maddening. Could I file this as a jira?
> Maybe I'll even supply a patch. :-)
>
> Thanks,
> Paul
>
> --
> View this message in context:
> http://www.nabble.com/properties-in-plugins-vs.-pom-tf2434529.html#a6789008
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>
Re: properties in plugins vs. pom
Posted by pjungwir <ma...@9stmaryrd.com>.
dan tran wrote:
>
> inconsistency i guess, I suggest to always start with ${project....}
>
I'm surprised at the implication: different code handles variable
replacement here vs. there.
Inconsistencies like this can be maddening. Could I file this as a jira?
Maybe I'll even supply a patch. :-)
Thanks,
Paul
--
View this message in context: http://www.nabble.com/properties-in-plugins-vs.-pom-tf2434529.html#a6789008
Sent from the Maven - Users mailing list archive at Nabble.com.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
For additional commands, e-mail: users-help@maven.apache.org
Re: properties in plugins vs. pom
Posted by Dan Tran <da...@gmail.com>.
inconsistency i guess, I suggest to always start with ${project....}
-D
On 10/12/06, pjungwir <ma...@9stmaryrd.com> wrote:
>
>
> Hello,
>
> I'm developing a plugin in maven 2.0.4. My plugin has a property annotated
> like this:
>
> /**
> * @parameter default-value="${artifactId}.exe"
> */
> private File outfile;
>
> When I use the plugin, outfile is set to
> "/home/pjungwir/src/encc/null.exe."
>
> But suppose I use this javadoc instead:
>
> /**
> * @parameter default-value="${project.artifactId}.exe"
> */
> private File outfile;
>
> Now outfile is set correctly, to "/home/pjungwir/src/encc/encc.exe."
>
> I thought this was strange, because when I use the antrun plugin, both of
> these produce the correct result:
>
> <execution>
> <id>blah</id>
> <phase>generate-sources</phase>
> <goals><goal>run</goal></goals>
> <configuration>
> <tasks>
> <echo message="${artifactId}"/>
> <echo message="${project.artifactId}"/>
> </tasks>
> </configuration>
> </execution>
>
> When I run this, I see:
>
> [INFO] Executing tasks
> [echo] encc
> [echo] encc
>
> So why does ${artifactId} work in the pom, but not in the plugin javadoc?
> Do
> maven variables have different names depending on context?
>
> Thanks,
> Paul
> --
> View this message in context:
> http://www.nabble.com/properties-in-plugins-vs.-pom-tf2434529.html#a6788751
> Sent from the Maven - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@maven.apache.org
> For additional commands, e-mail: users-help@maven.apache.org
>
>