You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by mi...@apache.org on 2023/02/20 21:13:05 UTC

[maven-integration-testing] branch maven-3.8.x updated: [MNG-7679] Backport to 3.8.x

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

michaelo pushed a commit to branch maven-3.8.x
in repository https://gitbox.apache.org/repos/asf/maven-integration-testing.git


The following commit(s) were added to refs/heads/maven-3.8.x by this push:
     new bb9e7f0d9 [MNG-7679] Backport to 3.8.x
bb9e7f0d9 is described below

commit bb9e7f0d9f2d8fad1006c599fd692f7f95d78701
Author: Tamas Cservenak <ta...@cservenak.net>
AuthorDate: Mon Feb 20 14:38:00 2023 +0100

    [MNG-7679] Backport to 3.8.x
---
 .../org/apache/maven/it/IntegrationTestSuite.java  |  1 +
 .../it/MavenITmng7679SingleMojoNoPomTest.java      | 61 ++++++++++++++++++++++
 .../src/test/resources/mng-7679/mng-7679.txt       |  1 +
 3 files changed, 63 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 ff2353bce..249c5c409 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( MavenITmng7679SingleMojoNoPomTest.class );
         suite.addTestSuite( MavenITmng7568SettingsProfileDeactivationTest.class );
         suite.addTestSuite( MavenITmng7474SessionScopeTest.class );
         suite.addTestSuite( MavenITmng7529VersionRangeRepositorySelection.class );
diff --git a/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7679SingleMojoNoPomTest.java b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7679SingleMojoNoPomTest.java
new file mode 100644
index 000000000..56e09f3d4
--- /dev/null
+++ b/core-it-suite/src/test/java/org/apache/maven/it/MavenITmng7679SingleMojoNoPomTest.java
@@ -0,0 +1,61 @@
+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;
+
+/**
+ * This is a test set for <a href="https://issues.apache.org/jira/browse/MNG-7679">MNG-7679</a>.
+ * Executing single mojo without POM should not NPE.
+ *
+ */
+public class MavenITmng7679SingleMojoNoPomTest
+    extends AbstractMavenIntegrationTestCase
+{
+
+    public MavenITmng7679SingleMojoNoPomTest()
+    {
+        // affected Maven versions: 3.8.7, 3.9.0, 4.0.0-alpha-4
+        super( "(,3.8.7)(3.8.7,3.9.0),(3.9.0,4.0.0-alpha-4),(4.0.0-alpha-4,)" );
+    }
+
+    /**
+     * Verify that maven invocation works (no NPE/error happens).
+     *
+     * @throws Exception in case of failure
+     */
+    public void testSingleMojoNoPom()
+        throws Exception
+    {
+        File testDir = ResourceExtractor.simpleExtractResources( getClass(), "/mng-7679" );
+
+        Verifier verifier = newVerifier( testDir.getAbsolutePath() );
+        verifier.addCliOption( "-Dfile=mng-7679.txt" );
+        verifier.addCliOption( "-DgroupId=org.apache.maven.it.mng7679" );
+        verifier.addCliOption( "-DartifactId=artifact" );
+        verifier.addCliOption( "-Dversion=1.0.0" );
+        verifier.addCliOption( "-Dpackaging=jar" );
+        verifier.executeGoal( "install:install-file" );
+        verifier.verifyErrorFreeLog();
+    }
+
+}
diff --git a/core-it-suite/src/test/resources/mng-7679/mng-7679.txt b/core-it-suite/src/test/resources/mng-7679/mng-7679.txt
new file mode 100644
index 000000000..30d74d258
--- /dev/null
+++ b/core-it-suite/src/test/resources/mng-7679/mng-7679.txt
@@ -0,0 +1 @@
+test
\ No newline at end of file