[MNG-5359] Declared execution in PluginMgmt gets bound to lifecycle (regression)
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/f2b16722 Tree: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/tree/f2b16722 Diff: http://git-wip-us.apache.org/repos/asf/maven-integration-testing/diff/f2b16722 Branch: refs/heads/MNG-5359 Commit: f2b167224f1a3379f70351ee4ac8e03480c60f3b Parents: 63bb518 Author: Christian Schulte <schu...@apache.org> Authored: Sun Dec 20 19:34:40 2015 +0100 Committer: Christian Schulte <schu...@apache.org> Committed: Tue Jan 31 04:08:38 2017 +0100 ---------------------------------------------------------------------- .../apache/maven/it/IntegrationTestSuite.java | 1 + ...ginExecutionDeclarationInPluginMgmtTest.java | 58 +++++++++++++++ .../src/test/resources/mng-5359/pom.xml | 74 ++++++++++++++++++++ .../java/org/apache/maven/its/mng5359/App.java | 13 ++++ 4 files changed, 146 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/f2b16722/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java ---------------------------------------------------------------------- diff --git a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java b/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java index a91eeb0..4021ff2 100644 --- a/core-it-suite/src/test/java/org/apache/maven/it/IntegrationTestSuite.java +++ b/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( MavenITmng5359CleanPluginExecutionDeclarationInPluginMgmtTest.class ); suite.addTestSuite( MavenITmng5958LifecyclePhaseBinaryCompat.class ); suite.addTestSuite( MavenITmng5898BuildMultimoduleWithEARFailsToResolveWARTest.class ); suite.addTestSuite( MavenITmng5840ParentVersionRanges.class ); http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/f2b16722/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5359CleanPluginExecutionDeclarationInPluginMgmtTest.java ---------------------------------------------------------------------- diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5359CleanPluginExecutionDeclarationInPluginMgmtTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5359CleanPluginExecutionDeclarationInPluginMgmtTest.java new file mode 100644 index 0000000..a8fde23 --- /dev/null +++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5359CleanPluginExecutionDeclarationInPluginMgmtTest.java @@ -0,0 +1,58 @@ +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 org.apache.maven.it.util.ResourceExtractor; + +import java.io.File; + +/** + * This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-5359">MNG-5359</a>. + * + * @author Anders Hammar + */ +public class MavenITmng5359CleanPluginExecutionDeclarationInPluginMgmtTest + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng5359CleanPluginExecutionDeclarationInPluginMgmtTest() + { + // Might work with versions before 2.0.11, but not verified + super( "[2.0.11,3.0-alpha-1),[3.5.1,)" ); + } + + public void testit() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5359" ); + + Verifier verifier = newVerifier( testDir.getAbsolutePath(), "remote" ); + + verifier.setAutoclean( false ); + verifier.deleteDirectory( "target" ); + verifier.deleteArtifacts( "org.apache.maven.its.mng5359" ); + + verifier.executeGoal( "install" ); // will fail if clean plugin is executed + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + verifier.assertArtifactPresent( "org.apache.maven.its.mng5359", "test", "0.1-SNAPSHOT", "jar" ); + } +} http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/f2b16722/core-it-suite/src/test/resources/mng-5359/pom.xml ---------------------------------------------------------------------- diff --git a/core-it-suite/src/test/resources/mng-5359/pom.xml b/core-it-suite/src/test/resources/mng-5359/pom.xml new file mode 100644 index 0000000..8b13d9d --- /dev/null +++ b/core-it-suite/src/test/resources/mng-5359/pom.xml @@ -0,0 +1,74 @@ +<?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> + + <groupId>org.apache.maven.its.mng5359</groupId> + <artifactId>test</artifactId> + <version>0.1-SNAPSHOT</version> + <packaging>jar</packaging> + + <name>Maven Integration Test :: MNG-5359</name> + <description> + Verifies that an execution of maven-clean-plugin declared in pluginManagement doesn't make it bound to the build lifecycle. + </description> + + <properties> + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> + </properties> + + <build> + <pluginManagement> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-clean-plugin</artifactId> + <version>2.5</version> + <executions> + <execution> + <id>auto-clean</id> + <phase>package</phase> + <goals> + <goal>clean</goal> + </goals> + </execution> + </executions> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-compiler-plugin</artifactId> + <version>2.5.1</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-install-plugin</artifactId> + <version>2.4</version> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-jar-plugin</artifactId> + <version>2.4</version> + </plugin> + </plugins> + </pluginManagement> + </build> +</project> http://git-wip-us.apache.org/repos/asf/maven-integration-testing/blob/f2b16722/core-it-suite/src/test/resources/mng-5359/src/main/java/org/apache/maven/its/mng5359/App.java ---------------------------------------------------------------------- diff --git a/core-it-suite/src/test/resources/mng-5359/src/main/java/org/apache/maven/its/mng5359/App.java b/core-it-suite/src/test/resources/mng-5359/src/main/java/org/apache/maven/its/mng5359/App.java new file mode 100644 index 0000000..2f61c7d --- /dev/null +++ b/core-it-suite/src/test/resources/mng-5359/src/main/java/org/apache/maven/its/mng5359/App.java @@ -0,0 +1,13 @@ +package org.apache.maven.its.mng5359; + +/** + * Hello world! + * + */ +public class App +{ + public static void main( String[] args ) + { + System.out.println( "Hello World!" ); + } +}