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 3cc9406  Add support for disabling project cloning with "none" value 
in `cloneProjectsTo` (#720)
3cc9406 is described below

commit 3cc94066d65ff032f1a2c0b1dcc2712853949223
Author: Slawomir Jaranowski <[email protected]>
AuthorDate: Fri Apr 10 09:04:32 2026 +0200

    Add support for disabling project cloning with "none" value in 
`cloneProjectsTo` (#720)
    
    * Add support for disabling project cloning with "none" value in 
`cloneProjectsTo`
    
    - Introduced handling for `cloneProjectsTo=none` to disable project cloning 
entirely.
    - Added integration test to verify functionality and ensure proper 
directory handling.
    - Updated documentation and comments for clarity.
    
    fix #712
    
    * Check if none value is directory
---
 src/it/clone-none/invoker.properties               | 18 ++++++
 src/it/clone-none/pom.xml                          | 64 ++++++++++++++++++++++
 src/it/clone-none/src/it/clone-none/pom.xml        | 32 +++++++++++
 src/it/clone-none/verify.groovy                    | 24 ++++++++
 .../maven/plugins/invoker/AbstractInvokerMojo.java | 28 ++++++++--
 5 files changed, 161 insertions(+), 5 deletions(-)

diff --git a/src/it/clone-none/invoker.properties 
b/src/it/clone-none/invoker.properties
new file mode 100644
index 0000000..1e1876a
--- /dev/null
+++ b/src/it/clone-none/invoker.properties
@@ -0,0 +1,18 @@
+# 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.
+
+invoker.goals = initialize
diff --git a/src/it/clone-none/pom.xml b/src/it/clone-none/pom.xml
new file mode 100644
index 0000000..675f153
--- /dev/null
+++ b/src/it/clone-none/pom.xml
@@ -0,0 +1,64 @@
+<?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 xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.plugins.invoker</groupId>
+  <artifactId>clone-none-invocation</artifactId>
+  <version>1.0-SNAPSHOT</version>
+  <packaging>pom</packaging>
+
+  <description>Test to check for special value none for 
cloneProjectsTo</description>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-invoker-plugin</artifactId>
+        <version>@project.version@</version>
+        <configuration>
+          <cloneProjectsTo>none</cloneProjectsTo>
+          <pomIncludes>
+            <pomInclude>*/pom.xml</pomInclude>
+          </pomIncludes>
+          <goals>
+            <goal>validate</goal>
+          </goals>
+        </configuration>
+        <executions>
+          <execution>
+            <id>integration-test</id>
+            <phase>initialize</phase>
+            <goals>
+              <goal>run</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+
+</project>
diff --git a/src/it/clone-none/src/it/clone-none/pom.xml 
b/src/it/clone-none/src/it/clone-none/pom.xml
new file mode 100644
index 0000000..a3b5143
--- /dev/null
+++ b/src/it/clone-none/src/it/clone-none/pom.xml
@@ -0,0 +1,32 @@
+<?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 xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/maven-v4_0_0.xsd";>
+  <modelVersion>4.0.0</modelVersion>
+  <groupId>test</groupId>
+  <artifactId>clone-none</artifactId>
+  <version>0.1-SNAPSHOT</version>
+  <packaging>jar</packaging>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+</project>
diff --git a/src/it/clone-none/verify.groovy b/src/it/clone-none/verify.groovy
new file mode 100644
index 0000000..35c76c0
--- /dev/null
+++ b/src/it/clone-none/verify.groovy
@@ -0,0 +1,24 @@
+/*
+ * 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/it/clone-none").exists()
+
+// without clone, the build log should be created in the source directory
+assert new File(basedir, "src/it/clone-none/build.log").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 ab56020..285c08b 100644
--- a/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java
+++ b/src/main/java/org/apache/maven/plugins/invoker/AbstractInvokerMojo.java
@@ -45,6 +45,7 @@ import java.util.List;
 import java.util.Locale;
 import java.util.Map;
 import java.util.Objects;
+import java.util.Optional;
 import java.util.Properties;
 import java.util.Set;
 import java.util.TreeSet;
@@ -180,13 +181,15 @@ public abstract class AbstractInvokerMojo extends 
AbstractMojo {
     private boolean disableReports;
 
     /**
-     * Directory to which projects should be cloned prior to execution. If set 
to {@code null}, each integration test
-     * will be run in the directory in which the corresponding IT POM was 
found. In this case, you most likely want to
+     * <p>Directory to which projects should be cloned prior to execution. If 
not set or set to special value {@code none},
+     * each integration test will be run in the directory in which the 
corresponding IT POM was found. In this case, you most likely want to
      * configure your SCM to ignore <code>target</code> and 
<code>build.log</code> in the test's base directory.
-     * (<b>Exception</b> when project using invoker plugin is of 
<i>maven-plugin</i> packaging:
-     * In such case IT projects will be cloned to and executed in 
<code>target/its</code> by default.)
      *
-     * Note: cloning needs to be enabled for properties filtering to work.
+     * <p><b>Exception</b>: when a project using invoker plugin is of 
<i>maven-plugin</i> packaging:
+     * In such a case IT projects will be cloned to and executed in 
<code>target/its</code> by default.
+     *
+     * <p><b>Note</b>: cloning needs to be enabled for properties filtering to 
work.
+     *
      * @since 1.1
      */
     @Parameter(property = "invoker.cloneProjectsTo")
@@ -775,6 +778,21 @@ public abstract class AbstractInvokerMojo extends 
AbstractMojo {
         this.interpolatorUtils = interpolatorUtils;
     }
 
+    public void setCloneProjectsTo(File cloneProjectsTo) {
+
+        Boolean isNoneValue = Optional.ofNullable(cloneProjectsTo)
+                .filter(file -> !file.isDirectory())
+                .map(File::getName)
+                .map(name -> name.equalsIgnoreCase("none"))
+                .orElse(false);
+
+        if (isNoneValue) {
+            this.cloneProjectsTo = null;
+        } else {
+            this.cloneProjectsTo = cloneProjectsTo;
+        }
+    }
+
     /**
      * Invokes Maven on the configured test projects.
      *

Reply via email to