Repository: maven-integration-testing Updated Branches: refs/heads/master ebb8ac933 -> 063f205c0
[MNG-6127] Add plugin execution configuration interference test This closes #16 Project: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/repo Commit: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/commit/063f205c Tree: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/tree/063f205c Diff: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/diff/063f205c Branch: refs/heads/master Commit: 063f205c0803d84491f444df76437e5380e0407c Parents: ebb8ac9 Author: Mario Krizmanic <mario.krizma...@gmail.com> Authored: Wed Nov 23 22:25:34 2016 +0100 Committer: Christian Schulte <schu...@apache.org> Committed: Thu Nov 24 08:24:32 2016 +0100 ---------------------------------------------------------------------- ...nExecutionConfigurationInterferenceTest.java | 75 +++++++++++++++++ .../src/test/resources/mng-6127/plugin/pom.xml | 55 +++++++++++++ .../maven/its/mng6127/plugin/TestMojo.java | 87 ++++++++++++++++++++ .../resources/META-INF/plexus/components.xml | 44 ++++++++++ .../resources/mng-6127/project/mod-a/pom.xml | 51 ++++++++++++ .../resources/mng-6127/project/mod-b/pom.xml | 51 ++++++++++++ .../resources/mng-6127/project/mod-c/pom.xml | 48 +++++++++++ .../src/test/resources/mng-6127/project/pom.xml | 37 +++++++++ 8 files changed, 448 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/063f205c/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6127PluginExecutionConfigurationInterferenceTest.java ---------------------------------------------------------------------- diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6127PluginExecutionConfigurationInterferenceTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6127PluginExecutionConfigurationInterferenceTest.java new file mode 100644 index 0000000..0df56f4 --- /dev/null +++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng6127PluginExecutionConfigurationInterferenceTest.java @@ -0,0 +1,75 @@ +package org.apache.maven.it; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 java.io.File; + +import org.apache.maven.it.util.ResourceExtractor; +import org.apache.maven.shared.utils.io.FileUtils; + +public class MavenITmng6127PluginExecutionConfigurationInterferenceTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng6127PluginExecutionConfigurationInterferenceTest() + { + super( "[3.4.0,)" ); + } + + public void testCustomMojoExecutionConfigurator() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-6127" ); + File pluginDir = new File( testDir, "plugin" ); + File projectDir = new File( testDir, "project" ); + File modAprojectDir = new File( projectDir, "mod-a" ); + File modBprojectDir = new File( projectDir, "mod-b" ); + File modCprojectDir = new File( projectDir, "mod-c" ); + + Verifier verifier; + + // install the test plugin + verifier = newVerifier( pluginDir.getAbsolutePath(), "remote" ); + verifier.executeGoal( "install" ); + verifier.resetStreams(); + verifier.verifyErrorFreeLog(); + + // build the test project + verifier = newVerifier( projectDir.getAbsolutePath(), "remote" ); + verifier.executeGoal( "install" ); + verifier.resetStreams(); + verifier.verifyErrorFreeLog(); + + File modAconfigurationFile = new File( modAprojectDir, "configuration.txt" ); + verifier.assertFilePresent( modAconfigurationFile.getCanonicalPath() ); + String modAactual = FileUtils.fileRead( modAconfigurationFile ); + assertEquals( "mod-asecond", modAactual ); + + File modBconfigurationFile = new File( modBprojectDir, "configuration.txt" ); + verifier.assertFilePresent( modBconfigurationFile.getCanonicalPath() ); + String modBactual = FileUtils.fileRead( modBconfigurationFile ); + assertEquals( "mod-bsecond", modBactual ); + + File modCconfigurationFile = new File( modCprojectDir, "configuration.txt" ); + verifier.assertFilePresent( modCconfigurationFile.getCanonicalPath() ); + String modCactual = FileUtils.fileRead( modCconfigurationFile ); + assertEquals( "second", modCactual ); + } +} http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/063f205c/core-it-suite/src/test/resources/mng-6127/plugin/pom.xml ---------------------------------------------------------------------- diff --git a/core-it-suite/src/test/resources/mng-6127/plugin/pom.xml b/core-it-suite/src/test/resources/mng-6127/plugin/pom.xml new file mode 100644 index 0000000..b8db3ed --- /dev/null +++ b/core-it-suite/src/test/resources/mng-6127/plugin/pom.xml @@ -0,0 +1,55 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you 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. +--> + +<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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>mng-6127</groupId> + <artifactId>mng-6127-plugin</artifactId> + <version>0.1</version> + <packaging>maven-plugin</packaging> + + <properties> + <maven-version>3.3.1</maven-version> + </properties> + + <dependencies> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-plugin-api</artifactId> + <version>${maven-version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-model</artifactId> + <version>${maven-version}</version> + <scope>provided</scope> + </dependency> + <dependency> + <groupId>org.apache.maven</groupId> + <artifactId>maven-core</artifactId> + <version>${maven-version}</version> + <scope>provided</scope> + </dependency> + </dependencies> +</project> http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/063f205c/core-it-suite/src/test/resources/mng-6127/plugin/src/main/java/org/apache/maven/its/mng6127/plugin/TestMojo.java ---------------------------------------------------------------------- diff --git a/core-it-suite/src/test/resources/mng-6127/plugin/src/main/java/org/apache/maven/its/mng6127/plugin/TestMojo.java b/core-it-suite/src/test/resources/mng-6127/plugin/src/main/java/org/apache/maven/its/mng6127/plugin/TestMojo.java new file mode 100644 index 0000000..23a3d12 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-6127/plugin/src/main/java/org/apache/maven/its/mng6127/plugin/TestMojo.java @@ -0,0 +1,87 @@ +package org.apache.maven.its.mng6127.plugin; + +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 java.io.File; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.OutputStreamWriter; +import java.io.Writer; + +import org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; +import org.apache.maven.project.MavenProject; + +/** + * Test mojo. + * + * @goal test + */ +public class TestMojo + extends AbstractMojo +{ + /** + * The Maven project. + * + * @parameter expression="${project}" + */ + private MavenProject project; + + /** + * The name to write. + * + * @parameter + */ + private String name; + + /** + * The second name to write. + * + * @parameter + */ + private String secondName; + + public void execute() + throws MojoExecutionException + { + try + { + File file = new File( project.getBasedir(), "configuration.txt" ); + file.getParentFile().mkdirs(); + Writer w = new OutputStreamWriter( new FileOutputStream( file, true ), "UTF-8" ); + try + { + if ( name != null ) + { + w.write( name ); + } + w.write( secondName ); + } + finally + { + w.close(); + } + } + catch ( IOException e ) + { + throw new MojoExecutionException( e.getMessage(), e ); + } + } +} http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/063f205c/core-it-suite/src/test/resources/mng-6127/plugin/src/main/resources/META-INF/plexus/components.xml ---------------------------------------------------------------------- diff --git a/core-it-suite/src/test/resources/mng-6127/plugin/src/main/resources/META-INF/plexus/components.xml b/core-it-suite/src/test/resources/mng-6127/plugin/src/main/resources/META-INF/plexus/components.xml new file mode 100644 index 0000000..7effd4d --- /dev/null +++ b/core-it-suite/src/test/resources/mng-6127/plugin/src/main/resources/META-INF/plexus/components.xml @@ -0,0 +1,44 @@ +<?xml version="1.0" encoding="UTF-8"?> +<component-set> + <components> + <component> + <role>org.apache.maven.lifecycle.mapping.LifecycleMapping</role> + <role-hint>mng-6127</role-hint> + <implementation> + org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping + </implementation> + <configuration> + <lifecycles> + <lifecycle> + <id>default</id> + <lifecyclePhases> + <generate-sources> + <mojos> + <mojo> + <goal>mng-6127:mng-6127-plugin:test</goal> + <configuration> + <secondName>second</secondName> + </configuration> + </mojo> + </mojos> + </generate-sources> + </lifecyclePhases> + </lifecycle> + </lifecycles> + </configuration> + </component> + <component> + <role>org.apache.maven.artifact.handler.ArtifactHandler</role> + <role-hint>mng-6127</role-hint> + <implementation> + org.apache.maven.artifact.handler.DefaultArtifactHandler + </implementation> + <configuration> + <type>mng-6127</type> + <extension>jar</extension> + <language>java</language> + <addedToClasspath>true</addedToClasspath> + </configuration> + </component> + </components> +</component-set> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/063f205c/core-it-suite/src/test/resources/mng-6127/project/mod-a/pom.xml ---------------------------------------------------------------------- diff --git a/core-it-suite/src/test/resources/mng-6127/project/mod-a/pom.xml b/core-it-suite/src/test/resources/mng-6127/project/mod-a/pom.xml new file mode 100644 index 0000000..c87b8cc --- /dev/null +++ b/core-it-suite/src/test/resources/mng-6127/project/mod-a/pom.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you 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. +--> + +<project> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>mng-6127</groupId> + <artifactId>mng-6127-project</artifactId> + <version>0.1</version> + </parent> + + <groupId>mng-6127</groupId> + <artifactId>mod-a</artifactId> + <version>0.1</version> + <packaging>mng-6127</packaging> + + <name>Maven Integration Test :: MNG-6127 :: Project A</name> + + <build> + <plugins> + <plugin> + <groupId>mng-6127</groupId> + <artifactId>mng-6127-plugin</artifactId> + <version>0.1</version> + <extensions>true</extensions> + <configuration> + <name>mod-a</name> + </configuration> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/063f205c/core-it-suite/src/test/resources/mng-6127/project/mod-b/pom.xml ---------------------------------------------------------------------- diff --git a/core-it-suite/src/test/resources/mng-6127/project/mod-b/pom.xml b/core-it-suite/src/test/resources/mng-6127/project/mod-b/pom.xml new file mode 100644 index 0000000..eae0055 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-6127/project/mod-b/pom.xml @@ -0,0 +1,51 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you 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. +--> + +<project> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>mng-6127</groupId> + <artifactId>mng-6127-project</artifactId> + <version>0.1</version> + </parent> + + <groupId>mng-6127</groupId> + <artifactId>mod-b</artifactId> + <version>0.1</version> + <packaging>mng-6127</packaging> + + <name>Maven Integration Test :: MNG-6127 :: Project B</name> + + <build> + <plugins> + <plugin> + <groupId>mng-6127</groupId> + <artifactId>mng-6127-plugin</artifactId> + <version>0.1</version> + <extensions>true</extensions> + <configuration> + <name>mod-b</name> + </configuration> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/063f205c/core-it-suite/src/test/resources/mng-6127/project/mod-c/pom.xml ---------------------------------------------------------------------- diff --git a/core-it-suite/src/test/resources/mng-6127/project/mod-c/pom.xml b/core-it-suite/src/test/resources/mng-6127/project/mod-c/pom.xml new file mode 100644 index 0000000..6a8eae1 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-6127/project/mod-c/pom.xml @@ -0,0 +1,48 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you 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. +--> + +<project> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>mng-6127</groupId> + <artifactId>mng-6127-project</artifactId> + <version>0.1</version> + </parent> + + <groupId>mng-6127</groupId> + <artifactId>mod-c</artifactId> + <version>0.1</version> + <packaging>mng-6127</packaging> + + <name>Maven Integration Test :: MNG-6127 :: Project C</name> + + <build> + <plugins> + <plugin> + <groupId>mng-6127</groupId> + <artifactId>mng-6127-plugin</artifactId> + <version>0.1</version> + <extensions>true</extensions> + </plugin> + </plugins> + </build> +</project> http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/063f205c/core-it-suite/src/test/resources/mng-6127/project/pom.xml ---------------------------------------------------------------------- diff --git a/core-it-suite/src/test/resources/mng-6127/project/pom.xml b/core-it-suite/src/test/resources/mng-6127/project/pom.xml new file mode 100644 index 0000000..e788fb2 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-6127/project/pom.xml @@ -0,0 +1,37 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you 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. +--> + +<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/xsd/maven-4.0.0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <groupId>mng-6127</groupId> + <artifactId>mng-6127-project</artifactId> + <packaging>pom</packaging> + <version>0.1</version> + + <modules> + <module>mod-a</module> + <module>mod-b</module> + <module>mod-c</module> + </modules> + +</project>