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 155f8e5cb..76b4c4084 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 static Test suite() // Tests that don't run stable and need to be fixed // ------------------------------------------------------------------------------------------------------------- // suite.addTestSuite( MavenIT0108SnapshotUpdateTest.class ); -- MNG-3137 + suite.addTestSuite( MavenITmng7353CliGoalInvocationTest.class ); suite.addTestSuite( MavenITmng7504NotWarnUnsupportedReportPluginsTest.class ); suite.addTestSuite( MavenITmng7160ExtensionClassloader.class ); suite.addTestSuite( MavenITmng7468UnsupportedPluginsParametersTest.class ); diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7353CliGoalInvocationTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7353CliGoalInvocationTest.java new file mode 100644 index 000000000..d5607eddf --- /dev/null +++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7353CliGoalInvocationTest.java @@ -0,0 +1,102 @@ +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; + +/** + * Tests new mvn prefix:version:goal, + * MNG-7353. + */ +public class MavenITmng7353CliGoalInvocationTest + extends AbstractMavenIntegrationTestCase +{ + public MavenITmng7353CliGoalInvocationTest() + { + super( "[3.9.0,)" ); + } + + private void run( String id, String goal, String expectedInvocation ) + throws Exception + { + File basedir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7353-cli-goal-invocation" ); + Verifier verifier = newVerifier( basedir.getAbsolutePath() ); + verifier.setLogFileName( id + ".txt" ); + verifier.executeGoal( goal ); + verifier.verifyTextInLog( "[INFO] --- " + expectedInvocation ); + verifier.resetStreams(); + } + + public void testPrefixGoal() + throws Exception + { + run( "pluginPrefix-goal", "dependency:list", "maven-dependency-plugin:3.3.0:list (default-cli)" ); + } + + public void testPrefixGoalAtId() + throws Exception + { + run( "pluginPrefix-goal@id", "dependency:list@id", "maven-dependency-plugin:3.3.0:list (id)" ); + } + + /** + * new pluginPrefix:version:goal in Maven 3.9.0 + */ + public void testPrefixVersionGoal() + throws Exception + { + run( "pluginPrefix-version-goal", "dependency:3.1.1:list", "maven-dependency-plugin:3.1.1:list (default-cli)" ); + } + + /** + * new pluginPrefix:version:goal in Maven 3.9.0 + */ + public void testPrefixVersionGoalAtId() + throws Exception + { + run( "pluginPrefix-goal@id", "dependency:3.1.1:list@id", "maven-dependency-plugin:3.1.1:list (id)" ); + } + + public void testGroupIdArtifactIdGoal() + throws Exception + { + run( "groupId-artifactId-goal", "org.apache.maven.plugins:maven-dependency-plugin:list", "maven-dependency-plugin:3.3.0:list (default-cli)" ); + } + + public void testGroupIdArtifactIdGoalAtId() + throws Exception + { + run( "groupId-artifactId-goal@id", "org.apache.maven.plugins:maven-dependency-plugin:list@id", "maven-dependency-plugin:3.3.0:list (id)" ); + } + + public void testGroupIdArtifactIdVersionGoal() + throws Exception + { + run( "groupId-artifactId-version-goal", "org.apache.maven.plugins:maven-dependency-plugin:3.1.1:list", "maven-dependency-plugin:3.1.1:list (default-cli)" ); + } + + public void testGroupIdArtifactIdVersionGoalAtId() + throws Exception + { + run( "groupId-artifactId-version-goal@id", "org.apache.maven.plugins:maven-dependency-plugin:3.1.1:list@id", "maven-dependency-plugin:3.1.1:list (id)" ); + } +} diff --git a/core-it-suite/src/test/resources/mng-7353-cli-goal-invocation/pom.xml b/core-it-suite/src/test/resources/mng-7353-cli-goal-invocation/pom.xml new file mode 100644 index 000000000..476dd6f17 --- /dev/null +++ b/core-it-suite/src/test/resources/mng-7353-cli-goal-invocation/pom.xml @@ -0,0 +1,44 @@ + + + + + + 4.0.0 + + org.apache.maven.its.mng7353 + test + 1 + + Maven Integration Test :: MNG-7353 + + Verify that "mvn pluginPrefix:version:goal" works and does not break any other goal invocation format + + + + + + + maven-dependency-plugin + 3.3.0 + + + + +