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

[maven-invoker-plugin] branch master updated: [MINVOKER-306] - Fixed bug if only exclude-patterns specified

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

sjaranowski pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git


The following commit(s) were added to refs/heads/master by this push:
     new c07ca87  [MINVOKER-306] - Fixed bug if only exclude-patterns specified
c07ca87 is described below

commit c07ca87f7261ff613ba5b3cdb4bc2817b810ce1e
Author: Vladimir V. Bychkov <gi...@bychkov.name>
AuthorDate: Tue Jul 26 18:06:41 2022 +0200

    [MINVOKER-306] - Fixed bug if only exclude-patterns specified
---
 .../pom.xml                                         |  4 ++--
 .../pom.xml                                         |  2 +-
 src/it/invocation-cmdline-exclude/test.properties   |  2 +-
 src/it/invocation-cmdline-exclude/verify.groovy     | 21 +++++++++++++++++++++
 .../maven/plugins/invoker/AbstractInvokerMojo.java  |  4 ++++
 5 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/src/it/invocation-cmdline-exclude/src/it/minvoker-140/pom.xml b/src/it/invocation-cmdline-exclude/src/it/minvoker-140-executable/pom.xml
similarity index 96%
copy from src/it/invocation-cmdline-exclude/src/it/minvoker-140/pom.xml
copy to src/it/invocation-cmdline-exclude/src/it/minvoker-140-executable/pom.xml
index 03381ce..948f8df 100644
--- a/src/it/invocation-cmdline-exclude/src/it/minvoker-140/pom.xml
+++ b/src/it/invocation-cmdline-exclude/src/it/minvoker-140-executable/pom.xml
@@ -35,7 +35,7 @@ under the License.
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-enforcer-plugin</artifactId>
-        <version>1.1.1</version>
+        <version>3.1.0</version>
         <executions>
           <execution>
             <goals>
@@ -43,7 +43,7 @@ under the License.
             </goals>
             <configuration>
               <rules>
-                <AlwaysFail/>
+                <AlwaysPass/>
               </rules>
             </configuration>
           </execution>
diff --git a/src/it/invocation-cmdline-exclude/src/it/minvoker-140/pom.xml b/src/it/invocation-cmdline-exclude/src/it/minvoker-140-ignorable/pom.xml
similarity index 98%
rename from src/it/invocation-cmdline-exclude/src/it/minvoker-140/pom.xml
rename to src/it/invocation-cmdline-exclude/src/it/minvoker-140-ignorable/pom.xml
index 03381ce..8d3de19 100644
--- a/src/it/invocation-cmdline-exclude/src/it/minvoker-140/pom.xml
+++ b/src/it/invocation-cmdline-exclude/src/it/minvoker-140-ignorable/pom.xml
@@ -35,7 +35,7 @@ under the License.
       <plugin>
         <groupId>org.apache.maven.plugins</groupId>
         <artifactId>maven-enforcer-plugin</artifactId>
-        <version>1.1.1</version>
+        <version>3.1.0</version>
         <executions>
           <execution>
             <goals>
diff --git a/src/it/invocation-cmdline-exclude/test.properties b/src/it/invocation-cmdline-exclude/test.properties
index c27a067..704d76d 100644
--- a/src/it/invocation-cmdline-exclude/test.properties
+++ b/src/it/invocation-cmdline-exclude/test.properties
@@ -15,4 +15,4 @@
 # specific language governing permissions and limitations
 # under the License.
 
-invoker.test = !minvoker-140
+invoker.test = !*-ignorable
diff --git a/src/it/invocation-cmdline-exclude/verify.groovy b/src/it/invocation-cmdline-exclude/verify.groovy
new file mode 100644
index 0000000..aab48ab
--- /dev/null
+++ b/src/it/invocation-cmdline-exclude/verify.groovy
@@ -0,0 +1,21 @@
+/*
+ * 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.
+ */
+assert new File(basedir, 'target/invoker-reports/BUILD-minvoker-140-executable.xml').exists()
+assert !new File(basedir, 'target/invoker-reports/BUILD-minvoker-140-ignorable.xml').exists()
+
diff --git a/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java b/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java
index 53730df..62c94b6 100644
--- a/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java
+++ b/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java
@@ -2431,6 +2431,10 @@ public abstract class AbstractInvokerMojo
         }
         if ( excludes != null )
         {
+            if ( ( includes == null || includes.isEmpty() ) && !excludes.isEmpty() )
+            {
+                scanner.setIncludes( new String[] { "*" } );
+            }
             scanner.setExcludes( excludes.toArray( new String[0] ) );
         }
         scanner.addDefaultExcludes();