Author: jdcasey Date: Wed Jun 4 11:49:07 2008 New Revision: 663339 URL: http://svn.apache.org/viewvc?rev=663339&view=rev Log: [MNG-3530] Adding a second integration test that shows how POM properties display a similarly locked-down behavior after initial POM interpolation...this even happens in 2.0.8, in the case of POM properties.
Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/build-path/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/build-path/plugin/ - copied from r662909, maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/plugin/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/build-path/project/ - copied from r662909, maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/project/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/plugin/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/plugin/pom.xml (with props) maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/plugin/src/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/plugin/src/main/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/plugin/src/main/java/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/plugin/src/main/java/mng3530/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/plugin/src/main/java/mng3530/SetPropertyMojo.java (with props) maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/plugin/src/main/java/mng3530/ValidatePropertyMojo.java (with props) maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/project/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/project/pom.xml (with props) maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/project/src/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/project/src/main/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/project/src/main/java/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/project/src/main/java/tests/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/project/src/main/java/tests/App.java (with props) maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/project/src/test/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/project/src/test/java/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/project/src/test/java/tests/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/project/src/test/java/tests/AppTest.java (with props) Removed: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/build-path/project/target-modified/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/plugin/ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/project/ Modified: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3530ChangedPathInterpolationTest.java maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/build-path/plugin/pom.xml maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/build-path/project/pom.xml Modified: maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3530ChangedPathInterpolationTest.java URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3530ChangedPathInterpolationTest.java?rev=663339&r1=663338&r2=663339&view=diff ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3530ChangedPathInterpolationTest.java (original) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/java/org/apache/maven/integrationtests/MavenITmng3530ChangedPathInterpolationTest.java Wed Jun 4 11:49:07 2008 @@ -47,10 +47,38 @@ super( "(2.0.9,)" ); // only test in 2.0.9+ } - public void testitMNG3530 () + public void testitMNG3530_BuildPath() throws Exception { - File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-3530-changedPathInterpolation" ); + File testDir = ResourceExtractor.simpleExtractResources( getClass(), + "/mng-3530-changedPathInterpolation/build-path" ); + File pluginDir = new File( testDir, "plugin" ); + File projectDir = new File( testDir, "project" ); + + // First, install the plugin that modifies the project.build.directory and + // validates that the modification propagated into the validation-mojo + // configuration. Once this is installed, we can run a project build that + // uses it to see how Maven will respond to a modification in the project build directory. + Verifier verifier = new Verifier( pluginDir.getAbsolutePath() ); + verifier.executeGoal( "install" ); + + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + // Now, build the project. If the plugin configuration doesn't recognize + // the update to the project.build.directory, it will fail the build. + verifier = new Verifier( projectDir.getAbsolutePath() ); + + verifier.executeGoal( "package" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + } + + public void testitMNG3530_POMProperty() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), + "/mng-3530-changedPathInterpolation/pom-property" ); File pluginDir = new File( testDir, "plugin" ); File projectDir = new File( testDir, "project" ); Modified: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/build-path/plugin/pom.xml URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/build-path/plugin/pom.xml?rev=663339&r1=662909&r2=663339&view=diff ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/build-path/plugin/pom.xml (original) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/build-path/plugin/pom.xml Wed Jun 4 11:49:07 2008 @@ -2,7 +2,7 @@ <project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <modelVersion>4.0.0</modelVersion> <groupId>org.apache.maven.its.mng3530</groupId> - <artifactId>plugin</artifactId> + <artifactId>build-path-maven-plugin</artifactId> <packaging>maven-plugin</packaging> <version>1</version> <name>plugin Maven Mojo</name> Modified: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/build-path/project/pom.xml URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/build-path/project/pom.xml?rev=663339&r1=662909&r2=663339&view=diff ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/build-path/project/pom.xml (original) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/build-path/project/pom.xml Wed Jun 4 11:49:07 2008 @@ -2,7 +2,7 @@ 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.its.mng3530</groupId> - <artifactId>project</artifactId> + <artifactId>build-path-project</artifactId> <packaging>jar</packaging> <version>1</version> <name>project</name> @@ -20,7 +20,7 @@ <plugins> <plugin> <groupId>org.apache.maven.its.mng3530</groupId> - <artifactId>plugin</artifactId> + <artifactId>build-path-maven-plugin</artifactId> <version>1</version> <executions> <execution> Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/plugin/pom.xml URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/plugin/pom.xml?rev=663339&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/plugin/pom.xml (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/plugin/pom.xml Wed Jun 4 11:49:07 2008 @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> + <modelVersion>4.0.0</modelVersion> + <groupId>org.apache.maven.its.mng3530</groupId> + <artifactId>pom-property-maven-plugin</artifactId> + <packaging>maven-plugin</packaging> + <version>1</version> + <name>plugin Maven Mojo</name> + <url>http://maven.apache.org</url> + <dependencies> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-plugin-api</artifactId> + <version>2.0</version> + </dependency> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-project</artifactId> + <version>2.0.6</version> + </dependency> + </dependencies> +</project> \ No newline at end of file Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/plugin/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/plugin/pom.xml ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/plugin/src/main/java/mng3530/SetPropertyMojo.java URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/plugin/src/main/java/mng3530/SetPropertyMojo.java?rev=663339&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/plugin/src/main/java/mng3530/SetPropertyMojo.java (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/plugin/src/main/java/mng3530/SetPropertyMojo.java Wed Jun 4 11:49:07 2008 @@ -0,0 +1,69 @@ +package mng3530; + +/* + * Copyright 2001-2005 The Apache Software Foundation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import org.apache.maven.plugin.Mojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.logging.Log; +import org.apache.maven.project.MavenProject; + +/** + * Modify the POM property myDirectory, contained in the current + * project instance. This and the corresponding [EMAIL PROTECTED] ValidatePropertyMojo} should + * prove or disprove the ability to have POM-property modifications ripple through + * the project's values, such as plugin configurations. + * + * @goal set + * @phase compile + */ +public class SetPropertyMojo + implements Mojo +{ + public static final String MODIFIED_PROPERTY_VALUE = "modified"; + + /** + * Project instance to modify. + * + * @parameter default-value="${project}" + * @required + * @readonly + */ + private MavenProject project; + + private Log log; + + public void execute() + throws MojoExecutionException + { + getLog().info( "Before modification, myDirectory is: " + project.getProperties().getProperty( "myDirectory" ) ); + + project.getProperties().setProperty( "myDirectory", MODIFIED_PROPERTY_VALUE ); + + getLog().info( "After modification, myDirectory is: " + project.getProperties().getProperty( "myDirectory" ) ); + getLog().info( "Modifications complete." ); + } + + public Log getLog() + { + return log; + } + + public void setLog( Log log ) + { + this.log = log; + } +} Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/plugin/src/main/java/mng3530/SetPropertyMojo.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/plugin/src/main/java/mng3530/SetPropertyMojo.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/plugin/src/main/java/mng3530/ValidatePropertyMojo.java URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/plugin/src/main/java/mng3530/ValidatePropertyMojo.java?rev=663339&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/plugin/src/main/java/mng3530/ValidatePropertyMojo.java (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/plugin/src/main/java/mng3530/ValidatePropertyMojo.java Wed Jun 4 11:49:07 2008 @@ -0,0 +1,63 @@ +package mng3530; + +import org.apache.maven.plugin.Mojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.plugin.MojoFailureException; +import org.apache.maven.plugin.logging.Log; +import org.apache.maven.project.MavenProject; + +/** + * Validate that the POM property has been reset by the [EMAIL PROTECTED] SetPropertyMojo}. + * + * @goal validate + * @phase package + */ +public class ValidatePropertyMojo + implements Mojo +{ + + /** + * @parameter + */ + private String buildDirectory; + + /** + * Project instance to validate. + * + * @parameter expression="${project}" + * @required + * @readonly + */ + private MavenProject project; + + private Log log; + + public void execute() + throws MojoExecutionException, MojoFailureException + { + getLog().info( "Validating buildDirectory parameter: " + buildDirectory ); + String apiValue = project.getProperties().getProperty( "myDirectory" ); + + if ( !apiValue.equals( buildDirectory ) ) + { + throw new MojoExecutionException( "buildDirectory parameter value:\n\n" + buildDirectory + + "\n\ndoes not match ${myDirectory} from project:\n\n" + + apiValue + "\n" ); + } + else + { + getLog().info( "buildDirectory matches ${myDirectory} in the current POM instance." ); + } + } + + public Log getLog() + { + return log; + } + + public void setLog( Log log ) + { + this.log = log; + } + +} Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/plugin/src/main/java/mng3530/ValidatePropertyMojo.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/plugin/src/main/java/mng3530/ValidatePropertyMojo.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/project/pom.xml URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/project/pom.xml?rev=663339&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/project/pom.xml (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/project/pom.xml Wed Jun 4 11:49:07 2008 @@ -0,0 +1,49 @@ +<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.its.mng3530</groupId> + <artifactId>pom-property-project</artifactId> + <packaging>jar</packaging> + <version>1</version> + <name>project</name> + <url>http://maven.apache.org</url> + <dependencies> + <dependency> + <groupId>junit</groupId> + <artifactId>junit</artifactId> + <version>3.8.1</version> + <scope>test</scope> + </dependency> + </dependencies> + + <properties> + <myDirectory>something</myDirectory> + </properties> + + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.its.mng3530</groupId> + <artifactId>pom-property-maven-plugin</artifactId> + <version>1</version> + <executions> + <execution> + <id>set</id> + <goals> + <goal>set</goal> + </goals> + </execution> + <execution> + <id>validate</id> + <goals> + <goal>validate</goal> + </goals> + <configuration> + <buildDirectory>${myDirectory}</buildDirectory> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> +</project> Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/project/pom.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/project/pom.xml ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/project/src/main/java/tests/App.java URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/project/src/main/java/tests/App.java?rev=663339&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/project/src/main/java/tests/App.java (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/project/src/main/java/tests/App.java Wed Jun 4 11:49:07 2008 @@ -0,0 +1,13 @@ +package tests; + +/** + * Hello world! + * + */ +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + } +} Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/project/src/main/java/tests/App.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/project/src/main/java/tests/App.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision" Added: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/project/src/test/java/tests/AppTest.java URL: http://svn.apache.org/viewvc/maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/project/src/test/java/tests/AppTest.java?rev=663339&view=auto ============================================================================== --- maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/project/src/test/java/tests/AppTest.java (added) +++ maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/project/src/test/java/tests/AppTest.java Wed Jun 4 11:49:07 2008 @@ -0,0 +1,38 @@ +package tests; + +import junit.framework.Test; +import junit.framework.TestCase; +import junit.framework.TestSuite; + +/** + * Unit test for simple App. + */ +public class AppTest + extends TestCase +{ + /** + * Create the test case + * + * @param testName name of the test case + */ + public AppTest( String testName ) + { + super( testName ); + } + + /** + * @return the suite of tests being tested + */ + public static Test suite() + { + return new TestSuite( AppTest.class ); + } + + /** + * Rigourous Test :-) + */ + public void testApp() + { + assertTrue( true ); + } +} Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/project/src/test/java/tests/AppTest.java ------------------------------------------------------------------------------ svn:eol-style = native Propchange: maven/core-integration-testing/trunk/core-integration-tests/src/test/resources/mng-3530-changedPathInterpolation/pom-property/project/src/test/java/tests/AppTest.java ------------------------------------------------------------------------------ svn:keywords = "Author Date Id Revision"