You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by gn...@apache.org on 2026/09/23 21:43:15 UTC

(maven-install-plugin) branch fix/MINSTALL-205-install-file-parallel-warning created (now dad361c)

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

gnodet pushed a change to branch fix/MINSTALL-205-install-file-parallel-warning
in repository https://gitbox.apache.org/repos/asf/maven-install-plugin.git


      at dad361c  [MINSTALL-205] Remove unnecessary aggregator=true from install-file

This branch includes the following new commits:

     new dad361c  [MINSTALL-205] Remove unnecessary aggregator=true from install-file

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(maven-install-plugin) 01/01: [MINSTALL-205] Remove unnecessary aggregator=true from install-file

Posted by gn...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

gnodet pushed a commit to branch fix/MINSTALL-205-install-file-parallel-warning
in repository https://gitbox.apache.org/repos/asf/maven-install-plugin.git

commit dad361c172e64666f1d6eb0e660a429a76649e0a
Author: Guillaume Nodet <gn...@gmail.com>
AuthorDate: Wed Sep 23 21:43:00 2026 +0000

    [MINSTALL-205] Remove unnecessary aggregator=true from install-file
    
    install-file does not access the reactor projects - it installs an
    arbitrary external file into the local repository. The aggregator=true
    flag was causing Maven to acquire an exclusive write lock when the mojo
    ran, serializing all concurrent install-file executions in parallel
    builds (-T N) and emitting a spurious warning:
    
      The org.apache.maven.plugins:maven-install-plugin:...:install-file
      aggregator mojo is already being executed in this parallel build,
      those kind of mojos require exclusive access to reactor to prevent
      race conditions. This mojo execution will be blocked until the
      aggregator mojo is done.
    
    The mojo already carries projectRequired=false which is sufficient to
    allow invocation from a multi-module root without a project context.
    Removing aggregator=true lets concurrent install-file executions run
    truly in parallel without any warning.
    
    Fixes: https://github.com/apache/maven-install-plugin/issues/251
---
 src/it/MINSTALL-205/invoker.properties             |  19 +++++++
 .../MINSTALL-205/module1/external-module1-1.0.jar  | Bin 0 -> 160 bytes
 src/it/MINSTALL-205/module1/pom.xml                |  56 +++++++++++++++++++++
 .../MINSTALL-205/module2/external-module2-1.0.jar  | Bin 0 -> 160 bytes
 src/it/MINSTALL-205/module2/pom.xml                |  56 +++++++++++++++++++++
 src/it/MINSTALL-205/pom.xml                        |  47 +++++++++++++++++
 src/it/MINSTALL-205/setup.groovy                   |  29 +++++++++++
 src/it/MINSTALL-205/verify.groovy                  |  51 +++++++++++++++++++
 .../maven/plugins/install/InstallFileMojo.java     |   2 +-
 9 files changed, 259 insertions(+), 1 deletion(-)

diff --git a/src/it/MINSTALL-205/invoker.properties b/src/it/MINSTALL-205/invoker.properties
new file mode 100644
index 0000000..4e10ccd
--- /dev/null
+++ b/src/it/MINSTALL-205/invoker.properties
@@ -0,0 +1,19 @@
+# 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.
+
+# MINSTALL-205: run with 2 threads to trigger concurrent install-file executions
+invoker.goals = validate -T2
diff --git a/src/it/MINSTALL-205/module1/external-module1-1.0.jar b/src/it/MINSTALL-205/module1/external-module1-1.0.jar
new file mode 100644
index 0000000..ace852a
Binary files /dev/null and b/src/it/MINSTALL-205/module1/external-module1-1.0.jar differ
diff --git a/src/it/MINSTALL-205/module1/pom.xml b/src/it/MINSTALL-205/module1/pom.xml
new file mode 100644
index 0000000..af12231
--- /dev/null
+++ b/src/it/MINSTALL-205/module1/pom.xml
@@ -0,0 +1,56 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.maven.its.install.minstall205</groupId>
+    <artifactId>parent</artifactId>
+    <version>1.0</version>
+  </parent>
+
+  <artifactId>module1</artifactId>
+  <packaging>pom</packaging>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-install-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>install-external-jar</id>
+            <goals>
+              <goal>install-file</goal>
+            </goals>
+            <phase>validate</phase>
+            <configuration>
+              <groupId>org.apache.maven.its.install.minstall205</groupId>
+              <artifactId>external-module1</artifactId>
+              <version>1.0</version>
+              <packaging>jar</packaging>
+              <file>${project.basedir}/external-module1-1.0.jar</file>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/src/it/MINSTALL-205/module2/external-module2-1.0.jar b/src/it/MINSTALL-205/module2/external-module2-1.0.jar
new file mode 100644
index 0000000..ace852a
Binary files /dev/null and b/src/it/MINSTALL-205/module2/external-module2-1.0.jar differ
diff --git a/src/it/MINSTALL-205/module2/pom.xml b/src/it/MINSTALL-205/module2/pom.xml
new file mode 100644
index 0000000..4ffb3f3
--- /dev/null
+++ b/src/it/MINSTALL-205/module2/pom.xml
@@ -0,0 +1,56 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <parent>
+    <groupId>org.apache.maven.its.install.minstall205</groupId>
+    <artifactId>parent</artifactId>
+    <version>1.0</version>
+  </parent>
+
+  <artifactId>module2</artifactId>
+  <packaging>pom</packaging>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-install-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>install-external-jar</id>
+            <goals>
+              <goal>install-file</goal>
+            </goals>
+            <phase>validate</phase>
+            <configuration>
+              <groupId>org.apache.maven.its.install.minstall205</groupId>
+              <artifactId>external-module2</artifactId>
+              <version>1.0</version>
+              <packaging>jar</packaging>
+              <file>${project.basedir}/external-module2-1.0.jar</file>
+            </configuration>
+          </execution>
+        </executions>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/src/it/MINSTALL-205/pom.xml b/src/it/MINSTALL-205/pom.xml
new file mode 100644
index 0000000..189baa4
--- /dev/null
+++ b/src/it/MINSTALL-205/pom.xml
@@ -0,0 +1,47 @@
+<?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/xsd/maven-4.0.0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+
+  <groupId>org.apache.maven.its.install.minstall205</groupId>
+  <artifactId>parent</artifactId>
+  <version>1.0</version>
+  <packaging>pom</packaging>
+
+  <description>MINSTALL-205: Verify that install:install-file does not trigger an "aggregator mojo already being
+    executed" warning in a parallel build.  Both modules invoke install:install-file; with the old
+    aggregator=true they would serialize and emit a warning; after the fix they run concurrently
+    without any warning.</description>
+
+  <modules>
+    <module>module1</module>
+    <module>module2</module>
+  </modules>
+
+  <build>
+    <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-install-plugin</artifactId>
+        <version>@project.version@</version>
+      </plugin>
+    </plugins>
+  </build>
+</project>
diff --git a/src/it/MINSTALL-205/setup.groovy b/src/it/MINSTALL-205/setup.groovy
new file mode 100644
index 0000000..e86e8bd
--- /dev/null
+++ b/src/it/MINSTALL-205/setup.groovy
@@ -0,0 +1,29 @@
+/*
+ * 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.*;
+
+// Clean up artifacts installed by previous runs
+File group = new File( localRepositoryPath, "org/apache/maven/its/install/minstall205" );
+if ( group.exists() ) {
+    group.eachFileRecurse { it.delete() }
+    group.delete()
+}
+
+return true;
diff --git a/src/it/MINSTALL-205/verify.groovy b/src/it/MINSTALL-205/verify.groovy
new file mode 100644
index 0000000..34ea684
--- /dev/null
+++ b/src/it/MINSTALL-205/verify.groovy
@@ -0,0 +1,51 @@
+/*
+ * 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.
+ */
+
+// MINSTALL-205: install:install-file must not trigger an "aggregator mojo" warning
+// when two modules invoke it concurrently in a parallel (-T 2) build.
+
+import java.io.*;
+
+// 1. Both artifacts must have been installed successfully
+String[] paths = [
+    "org/apache/maven/its/install/minstall205/external-module1/1.0/external-module1-1.0.jar",
+    "org/apache/maven/its/install/minstall205/external-module1/1.0/external-module1-1.0.pom",
+    "org/apache/maven/its/install/minstall205/external-module2/1.0/external-module2-1.0.jar",
+    "org/apache/maven/its/install/minstall205/external-module2/1.0/external-module2-1.0.pom",
+];
+
+for ( String path : paths ) {
+    File file = new File( localRepositoryPath, path );
+    System.out.println( "Checking for existence of " + file );
+    if ( !file.isFile() ) {
+        throw new FileNotFoundException( "Missing: " + file.getAbsolutePath() );
+    }
+}
+
+// 2. The build log must NOT contain the "aggregator mojo already being executed" warning
+File buildLog = new File( basedir, "build.log" );
+String log = buildLog.text;
+
+if ( log.contains( "aggregator mojo is already being executed" ) ) {
+    throw new AssertionError(
+        "Build log contains the 'aggregator mojo is already being executed' warning, " +
+        "but install-file should no longer be an aggregator (MINSTALL-205)." );
+}
+
+return true;
diff --git a/src/main/java/org/apache/maven/plugins/install/InstallFileMojo.java b/src/main/java/org/apache/maven/plugins/install/InstallFileMojo.java
index 95e154b..3181f1f 100644
--- a/src/main/java/org/apache/maven/plugins/install/InstallFileMojo.java
+++ b/src/main/java/org/apache/maven/plugins/install/InstallFileMojo.java
@@ -55,7 +55,7 @@ import org.apache.maven.api.services.xml.XmlReaderException;
 /**
  * Installs a file in the local repository.
  */
-@Mojo(name = "install-file", projectRequired = false, aggregator = true)
+@Mojo(name = "install-file", projectRequired = false)
 @SuppressWarnings("unused")
 public class InstallFileMojo implements org.apache.maven.api.plugin.Mojo {
     private static final String TAR = "tar.";