You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by hb...@apache.org on 2022/07/03 15:56:10 UTC

[maven-integration-testing] 01/01: [MNG-7353] test prefix:version:goal invocation and every other CLI

This is an automated email from the ASF dual-hosted git repository.

hboutemy pushed a commit to branch MNG-7353
in repository https://gitbox.apache.org/repos/asf/maven-integration-testing.git

commit c9e3d479bfae2d7ee7c8a05a7dcadb25aa2e27ed
Author: Hervé Boutemy <hb...@apache.org>
AuthorDate: Sun Jul 3 17:56:02 2022 +0200

    [MNG-7353] test prefix:version:goal invocation and every other CLI
---
 .../org/apache/maven/it/IntegrationTestSuite.java  |   1 +
 .../it/MavenITmng7353CliGoalInvocationTest.java    | 102 +++++++++++++++++++++
 .../resources/mng-7353-cli-goal-invocation/pom.xml |  44 +++++++++
 3 files changed, 147 insertions(+)

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 2c38909b7..8415f32a7 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
         // 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..b4a82dcfb
--- /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 <code>mvn prefix:version:goal</code>, 
+ * <a href="https://issues.apache.org/jira/browse/MNG-7353">MNG-7353</a>.
+ */
+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 @@
+<?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.mng7353</groupId>
+  <artifactId>test</artifactId>
+  <version>1</version>
+
+  <name>Maven Integration Test :: MNG-7353</name>
+  <description>
+    Verify that "mvn pluginPrefix:version:goal" works and does not break any other goal invocation format
+  </description>
+
+  <build>
+    <pluginManagement>
+      <plugins>
+        <plugin>
+          <artifactId>maven-dependency-plugin</artifactId>
+          <version>3.3.0</version>
+        </plugin>
+      </plugins>
+    </pluginManagement>
+  </build>
+</project>