diff --git a/maven-core-integration-tests/src/test/resources/it0090/pom.xml b/maven-core-integration-tests/src/test/resources/it0090/pom.xml new file mode 100644 index 0000000000..1db4f00340 --- /dev/null +++ b/maven-core-integration-tests/src/test/resources/it0090/pom.xml @@ -0,0 +1,43 @@ + + 4.0.0 + org.apache.maven.it + maven-core-it0090 + Test that ensures that envars are interpolated correctly into plugin + configurations. + 1.0 + + + junit + junit + 3.8.1 + jar + test + + + + + + src/main/resources + true + + + + + org.apache.maven.plugins + maven-core-it-plugin + 1.0 + + + process-resources + + ${env.MAVEN_TEST_ENVAR} + + + generate-envar-properties + + + + + + + diff --git a/maven-core-integration-tests/src/test/resources/it0090/src/main/resources/test.properties b/maven-core-integration-tests/src/test/resources/it0090/src/main/resources/test.properties new file mode 100644 index 0000000000..658e54becd --- /dev/null +++ b/maven-core-integration-tests/src/test/resources/it0090/src/main/resources/test.properties @@ -0,0 +1,2 @@ +# When we want to test the filtering of envars +maven.test.envar=${env.MAVEN_TEST_ENVAR} diff --git a/maven-core-integration-tests/src/test/resources/it0090/src/test/java/org/apache/maven/it0090/PomInterpolationTest.java b/maven-core-integration-tests/src/test/resources/it0090/src/test/java/org/apache/maven/it0090/PomInterpolationTest.java new file mode 100644 index 0000000000..a89e4cf145 --- /dev/null +++ b/maven-core-integration-tests/src/test/resources/it0090/src/test/java/org/apache/maven/it0090/PomInterpolationTest.java @@ -0,0 +1,35 @@ +package org.apache.maven.it0090; + +import junit.framework.TestCase; + +import java.util.Properties; +import java.io.File; +import java.io.FileInputStream; + +public class PomInterpolationTest + extends TestCase +{ + private String basedir; + + protected void setUp() + throws Exception + { + basedir = System.getProperty( "basedir" ); + } + + public void testProjectBuildDirectoryAfterForMojoExecution() + throws Exception + { + Properties testProperties = new Properties(); + + File testPropertiesFile = new File( basedir, "target/mojo-generated.properties" ); + + assertTrue( testPropertiesFile.exists() ); + + testProperties.load( new FileInputStream( testPropertiesFile ) ); + + File projectBuildDirectory = new File( basedir, "target" ); + + assertEquals( testProperties.getProperty( "maven.test.envar" ), "MAVEN_TEST_ENVAR_VALUE" ); + } +}