From 2e478d0de31e52385fbca9dc511197611ad8675f Mon Sep 17 00:00:00 2001 From: Anton Tanasenko Date: Mon, 20 Apr 2015 00:50:37 +0300 Subject: [PATCH] MNG-5805: Custom packaging types: configuring DefaultLifecycleMapping mojo executions Signed-off-by: Jason van Zyl --- .../apache/maven/it/IntegrationTestSuite.java | 1 + ...avenITmng5805PkgTypeMojoConfiguration.java | 43 +++++++++++++++ .../extension/pom.xml | 30 ++++++++++ .../resources/META-INF/plexus/components.xml | 53 ++++++++++++++++++ .../plugin-dep/pom.xml | 30 ++++++++++ .../apache/maven/its/mng5805/TestClass1.java | 5 ++ .../plugin/pom.xml | 55 +++++++++++++++++++ .../maven/its/mng5805/plugin/TestMojo.java | 51 +++++++++++++++++ .../project/pom.xml | 40 ++++++++++++++ 9 files changed, 308 insertions(+) create mode 100644 its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5805PkgTypeMojoConfiguration.java create mode 100644 its/core-it-suite/src/test/resources/mng-5805-pkg-type-mojo-configuration/extension/pom.xml create mode 100644 its/core-it-suite/src/test/resources/mng-5805-pkg-type-mojo-configuration/extension/src/main/resources/META-INF/plexus/components.xml create mode 100644 its/core-it-suite/src/test/resources/mng-5805-pkg-type-mojo-configuration/plugin-dep/pom.xml create mode 100644 its/core-it-suite/src/test/resources/mng-5805-pkg-type-mojo-configuration/plugin-dep/src/main/java/org/apache/maven/its/mng5805/TestClass1.java create mode 100644 its/core-it-suite/src/test/resources/mng-5805-pkg-type-mojo-configuration/plugin/pom.xml create mode 100644 its/core-it-suite/src/test/resources/mng-5805-pkg-type-mojo-configuration/plugin/src/main/java/org/apache/maven/its/mng5805/plugin/TestMojo.java create mode 100644 its/core-it-suite/src/test/resources/mng-5805-pkg-type-mojo-configuration/project/pom.xml 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 98e5752968..662b30b77b 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( MavenITmng5805PkgTypeMojoConfiguration.class ); suite.addTestSuite( MavenITmng5783PluginDependencyFiltering.class ); suite.addTestSuite( MavenITmng5774ConfigurationProcessorsTest.class ); suite.addTestSuite( MavenITmng5771CoreExtensionsTest.class ); diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5805PkgTypeMojoConfiguration.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5805PkgTypeMojoConfiguration.java new file mode 100644 index 0000000000..b0dec8d54a --- /dev/null +++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng5805PkgTypeMojoConfiguration.java @@ -0,0 +1,43 @@ +package org.apache.maven.it; + +import java.io.File; + +import org.apache.maven.it.util.ResourceExtractor; + +public class MavenITmng5805PkgTypeMojoConfiguration + extends AbstractMavenIntegrationTestCase +{ + + public MavenITmng5805PkgTypeMojoConfiguration() + { + super( "(3.3.2,)" ); + } + + public void testPkgTypeMojoConfiguration() + throws Exception + { + File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-5805-pkg-type-mojo-configuration" ); + + Verifier verifier; + + verifier = newVerifier( new File( testDir, "extension" ).getAbsolutePath() ); + verifier.executeGoal( "install" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + verifier = newVerifier( new File( testDir, "plugin" ).getAbsolutePath() ); + verifier.executeGoal( "install" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + verifier = newVerifier( new File( testDir, "plugin-dep" ).getAbsolutePath() ); + verifier.executeGoal( "install" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + + verifier = newVerifier( new File( testDir, "project" ).getAbsolutePath() ); + verifier.executeGoal( "validate" ); + verifier.verifyErrorFreeLog(); + verifier.resetStreams(); + } +} diff --git a/its/core-it-suite/src/test/resources/mng-5805-pkg-type-mojo-configuration/extension/pom.xml b/its/core-it-suite/src/test/resources/mng-5805-pkg-type-mojo-configuration/extension/pom.xml new file mode 100644 index 0000000000..d3bda34b56 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5805-pkg-type-mojo-configuration/extension/pom.xml @@ -0,0 +1,30 @@ + + + + + + 4.0.0 + + mng-5805-pkg-type-mojo-configuration + mng-5805-pkg-type-mojo-configuration-extension + 0.1 + jar + diff --git a/its/core-it-suite/src/test/resources/mng-5805-pkg-type-mojo-configuration/extension/src/main/resources/META-INF/plexus/components.xml b/its/core-it-suite/src/test/resources/mng-5805-pkg-type-mojo-configuration/extension/src/main/resources/META-INF/plexus/components.xml new file mode 100644 index 0000000000..2bf810d495 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5805-pkg-type-mojo-configuration/extension/src/main/resources/META-INF/plexus/components.xml @@ -0,0 +1,53 @@ + + + + + + org.apache.maven.lifecycle.mapping.LifecycleMapping + mng5805 + org.apache.maven.lifecycle.mapping.DefaultLifecycleMapping + + + + default + + + + + + mng-5805-pkg-type-mojo-configuration:mng-5805-pkg-type-mojo-configuration-plugin:0.1:test + + + org.apache.maven.its.mng5805.TestClass1 + + + + org.apache.maven.its.mng5805 + plugin-dep + 0.1 + + + + + + + + + + + + + org.apache.maven.artifact.handler.ArtifactHandler + mng5805 + + org.apache.maven.artifact.handler.DefaultArtifactHandler + + + zip + mng5805 + mng5805 + + + + + diff --git a/its/core-it-suite/src/test/resources/mng-5805-pkg-type-mojo-configuration/plugin-dep/pom.xml b/its/core-it-suite/src/test/resources/mng-5805-pkg-type-mojo-configuration/plugin-dep/pom.xml new file mode 100644 index 0000000000..b640125663 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5805-pkg-type-mojo-configuration/plugin-dep/pom.xml @@ -0,0 +1,30 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng5805 + plugin-dep + 0.1 + + diff --git a/its/core-it-suite/src/test/resources/mng-5805-pkg-type-mojo-configuration/plugin-dep/src/main/java/org/apache/maven/its/mng5805/TestClass1.java b/its/core-it-suite/src/test/resources/mng-5805-pkg-type-mojo-configuration/plugin-dep/src/main/java/org/apache/maven/its/mng5805/TestClass1.java new file mode 100644 index 0000000000..e20a23c57a --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5805-pkg-type-mojo-configuration/plugin-dep/src/main/java/org/apache/maven/its/mng5805/TestClass1.java @@ -0,0 +1,5 @@ +package org.apache.maven.its.mng5805; + +public class TestClass1 { + +} diff --git a/its/core-it-suite/src/test/resources/mng-5805-pkg-type-mojo-configuration/plugin/pom.xml b/its/core-it-suite/src/test/resources/mng-5805-pkg-type-mojo-configuration/plugin/pom.xml new file mode 100644 index 0000000000..6a301316cb --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5805-pkg-type-mojo-configuration/plugin/pom.xml @@ -0,0 +1,55 @@ + + + + + + 4.0.0 + + mng-5805-pkg-type-mojo-configuration + mng-5805-pkg-type-mojo-configuration-plugin + 0.1 + maven-plugin + + + 3.3.1 + + + + + org.apache.maven + maven-plugin-api + ${maven-version} + provided + + + org.apache.maven + maven-model + ${maven-version} + provided + + + org.apache.maven + maven-core + ${maven-version} + provided + + + diff --git a/its/core-it-suite/src/test/resources/mng-5805-pkg-type-mojo-configuration/plugin/src/main/java/org/apache/maven/its/mng5805/plugin/TestMojo.java b/its/core-it-suite/src/test/resources/mng-5805-pkg-type-mojo-configuration/plugin/src/main/java/org/apache/maven/its/mng5805/plugin/TestMojo.java new file mode 100644 index 0000000000..b4e4e71291 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5805-pkg-type-mojo-configuration/plugin/src/main/java/org/apache/maven/its/mng5805/plugin/TestMojo.java @@ -0,0 +1,51 @@ +package org.apache.maven.its.mng5805.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 org.apache.maven.plugin.AbstractMojo; +import org.apache.maven.plugin.MojoExecutionException; + +/** + * @goal test + */ +public class TestMojo + extends AbstractMojo +{ + /** + * @parameter default-value="org.apache.maven.its.mng5805.DoesNotExist" + */ + private String className; + + public void execute() + throws MojoExecutionException + { + + getLog().info( "CLASS_NAME=" + className ); + + try + { + Class.forName( className ); + } + catch (ClassNotFoundException e) + { + throw new MojoExecutionException( e.getMessage(), e ); + } + } +} diff --git a/its/core-it-suite/src/test/resources/mng-5805-pkg-type-mojo-configuration/project/pom.xml b/its/core-it-suite/src/test/resources/mng-5805-pkg-type-mojo-configuration/project/pom.xml new file mode 100644 index 0000000000..bcc9131966 --- /dev/null +++ b/its/core-it-suite/src/test/resources/mng-5805-pkg-type-mojo-configuration/project/pom.xml @@ -0,0 +1,40 @@ + + + + + + 4.0.0 + + mng-5805-pkg-type-mojo-configuration + mng-5805-pkg-type-mojo-configuration-project + 0.1 + mng5805 + + + + + mng-5805-pkg-type-mojo-configuration + mng-5805-pkg-type-mojo-configuration-extension + 0.1 + + + +