diff --git a/its/apache-maven-3.2.2-bin.tar.gz b/its/apache-maven-3.2.2-bin.tar.gz deleted file mode 100644 index b369f195d7..0000000000 Binary files a/its/apache-maven-3.2.2-bin.tar.gz and /dev/null differ diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java b/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java index daec9a0f12..f3baf597d1 100644 --- a/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java @@ -106,6 +106,7 @@ public class IntegrationTestSuite // ------------------------------------------------------------------------------------------------------------- // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137 + suite.addTestSuite( MavenITmng5774ConfigurationProcessorsTest.class ); suite.addTestSuite( MavenITmng5771CoreExtensionsTest.class ); suite.addTestSuite( MavenITmng5768CliExecutionIdTest.class ); suite.addTestSuite( MavenITmng5742BuildExtensionClassloaderTest.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5774ConfigurationProcessorsTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5774ConfigurationProcessorsTest.java new file mode 100644 index 0000000000..b29204a789 --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5774ConfigurationProcessorsTest.java @@ -0,0 +1,64 @@ +package org.apache.maven.it; + +import java.io.File; +import java.util.Properties; + +import org.apache.maven.it.util.ResourceExtractor; + +public class MavenITmng5774ConfigurationProcessorsTest + extends AbstractMavenIntegrationTestCase +{ + public MavenITmng5774ConfigurationProcessorsTest() + { + super( "(3.2.5,)" ); + } + + public void testBehaviourWhereThereIsOneUserSuppliedConfigurationProcessor() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5774-configuration-processors" ); + + Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties() ); + + verifier = newVerifier( new File( testDir, "build-with-one-processor-valid" ).getAbsolutePath() ); + verifier.deleteDirectory( "target" ); + verifier.deleteArtifacts( "org.apache.maven.its.it-configuration-processors" ); + verifier.getCliOptions().add( "-s" ); + verifier.getCliOptions().add( new File( testDir, "settings.xml" ).getAbsolutePath() ); + verifier.executeGoal( "process-resources" ); + verifier.verifyErrorFreeLog(); + // Making sure our configuration processor executes + verifier.verifyTextInLog( "[INFO] ConfigurationProcessorOne.process()" ); + // We have a property value injected by our configuration processor. Make sure it's correct + verifier.assertFilePresent( "target/classes/result.properties" ); + Properties result = verifier.loadProperties( "target/classes/result.properties" ); + assertEquals( "yes", result.getProperty( "configurationProcessorContributedValue" ) ); + verifier.resetStreams(); + } + + public void testBehaviourWhereThereAreTwoUserSuppliedConfigurationProcessor() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5774-configuration-processors" ); + + Verifier verifier = newVerifier( testDir.getAbsolutePath() ); + verifier.filterFile( "settings-template.xml", "settings.xml", "UTF-8", verifier.newDefaultFilterProperties() ); + + verifier = newVerifier( new File( testDir, "build-with-two-processors-invalid" ).getAbsolutePath() ); + verifier.deleteDirectory( "target" ); + verifier.deleteArtifacts( "org.apache.maven.its.it-configuration-processors" ); + verifier.getCliOptions().add( "-s" ); + verifier.getCliOptions().add( new File( testDir, "settings.xml" ).getAbsolutePath() ); + try + { + verifier.executeGoal( "process-resources" ); + fail( "We expected this invocation to fail because of too many user supplied configuration processors being present" ); + } + catch ( VerificationException e ) + { + verifier.verifyTextInLog( "There can only be one user supplied ConfigurationProcessor" ); + } + verifier.resetStreams(); + } +} diff --git a/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/build-with-one-processor-valid/.mvn/extensions.xml b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/build-with-one-processor-valid/.mvn/extensions.xml new file mode 100644 index 0000000000..6e130c4743 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/build-with-one-processor-valid/.mvn/extensions.xml @@ -0,0 +1,28 @@ + + + + + + + org.apache.maven.its.it-configuration-processors + maven-it-configuration-processor-one + 0.1 + + diff --git a/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/build-with-one-processor-valid/pom.xml b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/build-with-one-processor-valid/pom.xml new file mode 100644 index 0000000000..74cf1e437e --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/build-with-one-processor-valid/pom.xml @@ -0,0 +1,45 @@ + + + + + + 4.0.0 + + org.apache.maven.its.it-core-extensions + test + 0.1 + jar + + Maven Integration Test :: it-core-extensions + + Verify that Maven loads core extensions and components contributed by the extensions are available to regular + plugins. + + + + + + src/main/resources + true + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/build-with-one-processor-valid/src/main/resources/result.properties b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/build-with-one-processor-valid/src/main/resources/result.properties new file mode 100644 index 0000000000..ee47fb3fff --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/build-with-one-processor-valid/src/main/resources/result.properties @@ -0,0 +1 @@ +configurationProcessorContributedValue = ${answer} diff --git a/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/build-with-two-processors-invalid/.mvn/extensions.xml b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/build-with-two-processors-invalid/.mvn/extensions.xml new file mode 100644 index 0000000000..053db48c2f --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/build-with-two-processors-invalid/.mvn/extensions.xml @@ -0,0 +1,33 @@ + + + + + + + org.apache.maven.its.it-configuration-processors + maven-it-configuration-processor-one + 0.1 + + + org.apache.maven.its.it-configuration-processors + maven-it-configuration-processor-two + 0.1 + + diff --git a/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/build-with-two-processors-invalid/pom.xml b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/build-with-two-processors-invalid/pom.xml new file mode 100644 index 0000000000..8613bfb5c5 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/build-with-two-processors-invalid/pom.xml @@ -0,0 +1,36 @@ + + + + + + 4.0.0 + + org.apache.maven.its.it-core-extensions + test + 0.1 + jar + + Maven Integration Test :: it-core-extensions + + Verify that Maven loads core extensions and components contributed by the extensions are available to regular + plugins. + + + diff --git a/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/configuration-processor-one/.gitignore b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/configuration-processor-one/.gitignore new file mode 100644 index 0000000000..b83d22266a --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/configuration-processor-one/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/configuration-processor-one/pom.xml b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/configuration-processor-one/pom.xml new file mode 100644 index 0000000000..604fd54868 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/configuration-processor-one/pom.xml @@ -0,0 +1,58 @@ + + + + + + 4.0.0 + + org.apache.maven.its.it-configuration-processors + maven-it-configuration-processor-one + 0.1 + jar + + Maven Integration Test :: maven-it-configuration-processors + + + + org.apache.maven + maven-embedder + 3.2.6-SNAPSHOT + provided + + + + + + + org.codehaus.plexus + plexus-component-metadata + 1.5.5 + + + + generate-metadata + + + + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/configuration-processor-one/src/main/java/org/apache/maven/its/configuration_processors/ConfigurationProcessorOne.java b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/configuration-processor-one/src/main/java/org/apache/maven/its/configuration_processors/ConfigurationProcessorOne.java new file mode 100644 index 0000000000..80c97bd23b --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/configuration-processor-one/src/main/java/org/apache/maven/its/configuration_processors/ConfigurationProcessorOne.java @@ -0,0 +1,21 @@ +package org.apache.maven.its.configuration_processors; + +import org.apache.maven.cli.CliRequest; +import org.apache.maven.cli.configuration.ConfigurationProcessor; +import org.codehaus.plexus.component.annotations.Component; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +@Component( role = ConfigurationProcessor.class, hint = "maven-core-it-one" ) +public class ConfigurationProcessorOne + implements ConfigurationProcessor +{ + private Logger logger = LoggerFactory.getLogger( ConfigurationProcessorOne.class ); + + public void process( CliRequest request ) + throws Exception + { + logger.info( "ConfigurationProcessorOne.process()" ); + request.getUserProperties().put( "answer", "yes" ); + } +} diff --git a/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/configuration-processor-two/.gitignore b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/configuration-processor-two/.gitignore new file mode 100644 index 0000000000..b83d22266a --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/configuration-processor-two/.gitignore @@ -0,0 +1 @@ +/target/ diff --git a/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/configuration-processor-two/pom.xml b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/configuration-processor-two/pom.xml new file mode 100644 index 0000000000..4c59ec08c2 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/configuration-processor-two/pom.xml @@ -0,0 +1,58 @@ + + + + + + 4.0.0 + + org.apache.maven.its.it-configuration-processors + maven-it-configuration-processor-two + 0.1 + jar + + Maven Integration Test :: maven-it-configuration-processors + + + + org.apache.maven + maven-embedder + 3.2.6-SNAPSHOT + provided + + + + + + + org.codehaus.plexus + plexus-component-metadata + 1.5.5 + + + + generate-metadata + + + + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/configuration-processor-two/src/main/java/org/apache/maven/its/configuration_processors/ConfigurationProcessorTwo.java b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/configuration-processor-two/src/main/java/org/apache/maven/its/configuration_processors/ConfigurationProcessorTwo.java new file mode 100644 index 0000000000..c98071e020 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/configuration-processor-two/src/main/java/org/apache/maven/its/configuration_processors/ConfigurationProcessorTwo.java @@ -0,0 +1,15 @@ +package org.apache.maven.its.configuration_processors; + +import org.apache.maven.cli.CliRequest; +import org.apache.maven.cli.configuration.ConfigurationProcessor; +import org.codehaus.plexus.component.annotations.Component; + +@Component( role = ConfigurationProcessor.class, hint = "maven-core-it-two" ) +public class ConfigurationProcessorTwo + implements ConfigurationProcessor +{ + public void process( CliRequest request ) + throws Exception + { + } +} diff --git a/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/repo/org/apache/maven/its/it-configuration-processors/maven-it-configuration-processor-one/0.1/maven-it-configuration-processor-one-0.1.jar b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/repo/org/apache/maven/its/it-configuration-processors/maven-it-configuration-processor-one/0.1/maven-it-configuration-processor-one-0.1.jar new file mode 100644 index 0000000000..8364b46838 Binary files /dev/null and b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/repo/org/apache/maven/its/it-configuration-processors/maven-it-configuration-processor-one/0.1/maven-it-configuration-processor-one-0.1.jar differ diff --git a/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/repo/org/apache/maven/its/it-configuration-processors/maven-it-configuration-processor-one/0.1/maven-it-configuration-processor-one-0.1.pom b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/repo/org/apache/maven/its/it-configuration-processors/maven-it-configuration-processor-one/0.1/maven-it-configuration-processor-one-0.1.pom new file mode 100644 index 0000000000..604fd54868 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/repo/org/apache/maven/its/it-configuration-processors/maven-it-configuration-processor-one/0.1/maven-it-configuration-processor-one-0.1.pom @@ -0,0 +1,58 @@ + + + + + + 4.0.0 + + org.apache.maven.its.it-configuration-processors + maven-it-configuration-processor-one + 0.1 + jar + + Maven Integration Test :: maven-it-configuration-processors + + + + org.apache.maven + maven-embedder + 3.2.6-SNAPSHOT + provided + + + + + + + org.codehaus.plexus + plexus-component-metadata + 1.5.5 + + + + generate-metadata + + + + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/repo/org/apache/maven/its/it-configuration-processors/maven-it-configuration-processor-two/0.1/maven-it-configuration-processor-two-0.1.jar b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/repo/org/apache/maven/its/it-configuration-processors/maven-it-configuration-processor-two/0.1/maven-it-configuration-processor-two-0.1.jar new file mode 100644 index 0000000000..ed2311f08b Binary files /dev/null and b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/repo/org/apache/maven/its/it-configuration-processors/maven-it-configuration-processor-two/0.1/maven-it-configuration-processor-two-0.1.jar differ diff --git a/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/repo/org/apache/maven/its/it-configuration-processors/maven-it-configuration-processor-two/0.1/maven-it-configuration-processor-two-0.1.pom b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/repo/org/apache/maven/its/it-configuration-processors/maven-it-configuration-processor-two/0.1/maven-it-configuration-processor-two-0.1.pom new file mode 100644 index 0000000000..4c59ec08c2 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/repo/org/apache/maven/its/it-configuration-processors/maven-it-configuration-processor-two/0.1/maven-it-configuration-processor-two-0.1.pom @@ -0,0 +1,58 @@ + + + + + + 4.0.0 + + org.apache.maven.its.it-configuration-processors + maven-it-configuration-processor-two + 0.1 + jar + + Maven Integration Test :: maven-it-configuration-processors + + + + org.apache.maven + maven-embedder + 3.2.6-SNAPSHOT + provided + + + + + + + org.codehaus.plexus + plexus-component-metadata + 1.5.5 + + + + generate-metadata + + + + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/settings-template.xml b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/settings-template.xml new file mode 100644 index 0000000000..8649e57c35 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5774-configuration-processors/settings-template.xml @@ -0,0 +1,43 @@ + + + + + + + + maven-core-it-repo + + + maven-core-it + @baseurl@/repo + + ignore + + + false + + + + + + + maven-core-it-repo + +