You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@maven.apache.org by Benjamin Bentmann <be...@udo.edu> on 2008/10/14 16:39:33 UTC
Re: svn commit: r704423 - /maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicTransformer.java
Hi Shane,
> Author: sisbell
> Date: Tue Oct 14 02:56:13 2008
> New Revision: 704423
>
> URL: http://svn.apache.org/viewvc?rev=704423&view=rev
> Log:
> Fix for IT100. During interpolation, something with 'parent.' needs to be aliased: 'project.parent.' I'm not sure that this is good behavior, given that someone may use 'parent. in their own context.
>
> Modified:
> maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicTransformer.java
>
> Modified: maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicTransformer.java
> URL: http://svn.apache.org/viewvc/maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicTransformer.java?rev=704423&r1=704422&r2=704423&view=diff
> ==============================================================================
> --- maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicTransformer.java (original)
> +++ maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicTransformer.java Tue Oct 14 02:56:13 2008
> @@ -558,6 +558,7 @@
> Map<String, String> aliases = new HashMap<String, String>();
> aliases.put( "project.", "pom.");
> aliases.put( "\\$\\{project.build.", "\\$\\{build.");
> + aliases.put( "\\$\\{project.parent.", "\\$\\{parent.");
>
I fear it's even more ugly than that. If you take a closer look at the
RegexBasedModelInterpolator from the 2.x branch, you will notice that
not only project.build and project.parent can be accessed without the
"project." prefix but that any POM element is interpolated without using
"pom." or "project." as prefix (see also [0]).
For this example POM
<project>
<modelVersion>4.0.0</modelVersion>
<groupId>foo</groupId>
<artifactId>bar</artifactId>
<version>1.0</version>
<name>test</name>
<description>desc</description>
<url>everywhere</url>
<organization>
<name>Apache</name>
</organization>
<properties>
<prop>${groupId} ${artifactId} ${version} ${name} ${description}
${url} ${organization.name}</prop>
</properties>
</project>
one gets
<prop>foo bar 1.0 test desc everywhere Apache</prop>
from the effective POM.
Since I currently cannot imagine a use case for this aliasing, I am +1
if the next model version would simplify/restrict the interpolation
semantics to not alias project.foo with foo.
Benjamin
[0] http://docs.codehaus.org/display/MAVEN/POM+Interpolation+Refactor.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org
Re: svn commit: r704423 - /maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicTransformer.java
Posted by Shane Isbell <sh...@gmail.com>.
It is pretty bad. In 2.0.x, if I define url="http"//sonatype.org", then this
value will be applied to ${url}. If later, someone defines
project.properties.url = "foobar", in either the child or parent pom, then
${url} will resolve to foobar. So in one case ${url} is ${project.url}, in
another case it is project.properties.url.
So it looks like the rule in 2.0.x is: for some A that is a model element
name, if ${project.properties.A} exists, ${A} = ${project.properties.A} ,
else.${A}=${project.A}.
Shane
On Tue, Oct 14, 2008 at 7:54 AM, Brian E. Fox <br...@reply.infinity.nu>wrote:
>
> >Since I currently cannot imagine a use case for this aliasing, I am +1
> >if the next model version would simplify/restrict the interpolation
> >semantics to not alias project.foo with foo.
>
> Same here but unfortunately this should be tied to the model version,
> otherwise a ton of stuff in central would suddenly be unusable.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
> For additional commands, e-mail: dev-help@maven.apache.org
>
>
RE: svn commit: r704423 - /maven/components/trunk/maven-project/src/main/java/org/apache/maven/project/builder/PomClassicTransformer.java
Posted by "Brian E. Fox" <br...@reply.infinity.nu>.
>Since I currently cannot imagine a use case for this aliasing, I am +1
>if the next model version would simplify/restrict the interpolation
>semantics to not alias project.foo with foo.
Same here but unfortunately this should be tied to the model version,
otherwise a ton of stuff in central would suddenly be unusable.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@maven.apache.org
For additional commands, e-mail: dev-help@maven.apache.org