(Merged from 384264.) [MNG-2124] Fixed interpolator to call the ReflectionValueExtractor method that prevents trimming the first expression token, since this is done in the interpolator itself. I'm still investigating whether this is going to break realignment of File instances to basedir during plugin parameter injection, but I've had to adjust it0088, since it is not handling project.build.directory as a File, but as a String.

git-svn-id: https://svn.apache.org/repos/asf/maven/components/trunk@384270 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
John Dennis Casey 2006-03-08 17:04:47 +00:00
parent e2be5ffc21
commit fc77014cfe
9 changed files with 113 additions and 5 deletions

View File

@ -266,7 +266,9 @@ it0097: Test that the implied relative path for the parent POM works, even two
it0098: Test that quoted system properties are processed correctly. [MNG-1415]
it0099: Test that parent-POMs cached during a build are available as parents
to other POMs in the multimodule build. [MNG-2124]
to other POMs in the multimodule build. [MNG-2130]
it0100: Test that ${parent.artifactId} resolves correctly. [MNG-2124]
-------------------------------------------------------------------------------

View File

@ -1,3 +1,4 @@
it0100
it0099
it0098
it0097

View File

@ -44,8 +44,9 @@ public class PomInterpolationTest
testProperties.load( new FileInputStream( testPropertiesFile ) );
File projectBuildDirectory = new File( basedir, "target" );
assertEquals( testProperties.getProperty( "project.build.directory" ), projectBuildDirectory.getAbsolutePath() );
// [jdcasey] NOTE: This property is not a java.io.File, so it will NOT be adjusted
// to the basedir! We need to simply check that it's value is "target", rather than
// new java.io.File( basedir, "target" ).getAbsolutePath();
assertEquals( testProperties.getProperty( "project.build.directory" ), "target" );
}
}

View File

@ -0,0 +1 @@
verify

View File

@ -0,0 +1,46 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<parent>
<artifactId>parent</artifactId>
<groupId>org.apache.maven.it0100</groupId>
<version>1.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>child</artifactId>
<name>child</name>
<packaging>pom</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-help-plugin</artifactId>
<executions>
<execution>
<configuration>
<output>target/effective-pom.txt</output>
</configuration>
<phase>initialize</phase>
<goals>
<goal>effective-pom</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-verifier-plugin</artifactId>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,8 @@
<verifications>
<files>
<file>
<location>target/effective-pom.txt</location>
<contains>Parent: parent, project: child</contains>
</file>
</files>
</verifications>

View File

@ -0,0 +1,32 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.it0100</groupId>
<artifactId>parent</artifactId>
<packaging>pom</packaging>
<version>1.0</version>
<name>parent</name>
<build>
<plugins>
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
<execution>
<phase>validate</phase>
<configuration>
<tasks>
<echo>Parent: ${pom.parent.artifactId}, project: ${pom.artifactId}</echo>
<echo>Parent: ${parent.artifactId}, project: ${pom.artifactId}</echo>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,14 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.apache.maven.it0100</groupId>
<artifactId>root</artifactId>
<packaging>pom</packaging>
<version>1.0</version>
<name>root</name>
<modules>
<module>parent/child</module>
</modules>
</project>

View File

@ -136,7 +136,10 @@ public class RegexBasedModelInterpolator
{
try
{
value = ReflectionValueExtractor.evaluate( realExpr, model );
// NOTE: We've already trimmed off any leading expression parts like 'project.'
// or 'pom.', and now we have to ensure that the ReflectionValueExtractor
// doesn't try to do it again.
value = ReflectionValueExtractor.evaluate( realExpr, model, false );
}
catch ( Exception e )
{