You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@maven.apache.org by sl...@apache.org on 2026/09/15 23:59:15 UTC
(maven-invoker-plugin) branch agent/install-ignore-split-repo created (now 49c03db)
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a change to branch agent/install-ignore-split-repo
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git
at 49c03db Ignore split local repository when installing IT artifacts
This branch includes the following new commits:
new 49c03db Ignore split local repository when installing IT artifacts
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-invoker-plugin) 01/01: Ignore split local repository when installing IT artifacts
Posted by sl...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
slachiewicz pushed a commit to branch agent/install-ignore-split-repo
in repository https://gitbox.apache.org/repos/asf/maven-invoker-plugin.git
commit 49c03db042b6dc11fe5eb1a7da703232b5913af3
Author: Sylwester Lachiewicz <sl...@apache.org>
AuthorDate: Wed Sep 16 01:59:04 2026 +0200
Ignore split local repository when installing IT artifacts
The forked IT builds only ever read a flat local repository, so if
the outer build enables aether.enhancedLocalRepository.split, install
must not let that config leak into the cloned session it builds for
the IT local repository, or every reactor artifact lands where the
IT can never resolve it.
Fixes #606
---
pom.xml | 1 +
.../.mvn/maven.config | 1 +
.../invoker.properties | 18 +++++++
.../MINVOKER-377-install-ignore-split-repo/pom.xml | 62 ++++++++++++++++++++++
.../verify.groovy | 32 +++++++++++
.../apache/maven/plugins/invoker/InstallMojo.java | 10 ++++
6 files changed, 124 insertions(+)
diff --git a/pom.xml b/pom.xml
index aa3e815..126dc7d 100644
--- a/pom.xml
+++ b/pom.xml
@@ -296,6 +296,7 @@ under the License.
<exclude>src/it/staging-dependencies/repo/**/*</exclude>
<exclude>src/it/**/*.txt</exclude>
<exclude>src/test/**/*.txt</exclude>
+ <exclude>src/it/**/.mvn/maven.config</exclude>
</excludes>
</configuration>
</plugin>
diff --git a/src/it/MINVOKER-377-install-ignore-split-repo/.mvn/maven.config b/src/it/MINVOKER-377-install-ignore-split-repo/.mvn/maven.config
new file mode 100644
index 0000000..bcc27a6
--- /dev/null
+++ b/src/it/MINVOKER-377-install-ignore-split-repo/.mvn/maven.config
@@ -0,0 +1 @@
+-Daether.enhancedLocalRepository.split=true
diff --git a/src/it/MINVOKER-377-install-ignore-split-repo/invoker.properties b/src/it/MINVOKER-377-install-ignore-split-repo/invoker.properties
new file mode 100644
index 0000000..71033d7
--- /dev/null
+++ b/src/it/MINVOKER-377-install-ignore-split-repo/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 = verify
diff --git a/src/it/MINVOKER-377-install-ignore-split-repo/pom.xml b/src/it/MINVOKER-377-install-ignore-split-repo/pom.xml
new file mode 100644
index 0000000..0f007b3
--- /dev/null
+++ b/src/it/MINVOKER-377-install-ignore-split-repo/pom.xml
@@ -0,0 +1,62 @@
+<?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.plugins.invoker</groupId>
+ <artifactId>minvoker377</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>jar</packaging>
+
+ <url>https://issues.apache.org/jira/browse/MINVOKER-377</url>
+ <description>
+ install must write to the flat local repository layout even when the outer build enabled
+ a split local repository (aether.enhancedLocalRepository.split), since the forked IT builds
+ read the plain flat layout.
+ </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>
+ <localRepositoryPath>${project.build.directory}/local-repo</localRepositoryPath>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>install</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git a/src/it/MINVOKER-377-install-ignore-split-repo/verify.groovy b/src/it/MINVOKER-377-install-ignore-split-repo/verify.groovy
new file mode 100644
index 0000000..10bcd74
--- /dev/null
+++ b/src/it/MINVOKER-377-install-ignore-split-repo/verify.groovy
@@ -0,0 +1,32 @@
+/*
+ * 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.
+ */
+
+// The outer build enabled a split local repository via .mvn/maven.config, but the forked
+// IT builds only ever read the flat layout, so invoker:install must ignore that setting and
+// write the flat layout regardless (MINVOKER-377).
+def localRepo = new File(basedir, 'target/local-repo')
+
+def pom = new File(localRepo, 'org/apache/maven/plugins/invoker/minvoker377/1.0-SNAPSHOT/minvoker377-1.0-SNAPSHOT.pom')
+def jar = new File(localRepo, 'org/apache/maven/plugins/invoker/minvoker377/1.0-SNAPSHOT/minvoker377-1.0-SNAPSHOT.jar')
+
+assert pom.isFile()
+assert jar.isFile()
+
+def splitDir = new File(localRepo, 'installed')
+assert !splitDir.exists()
diff --git a/src/main/java/org/apache/maven/plugins/invoker/InstallMojo.java b/src/main/java/org/apache/maven/plugins/invoker/InstallMojo.java
index 8ac1983..6beae3e 100644
--- a/src/main/java/org/apache/maven/plugins/invoker/InstallMojo.java
+++ b/src/main/java/org/apache/maven/plugins/invoker/InstallMojo.java
@@ -415,6 +415,16 @@ public class InstallMojo extends AbstractMojo {
if ("enhanced".equals(contentType)) {
contentType = "default";
}
+ // Forked IT builds are invoked with -Dmaven.repo.local pointing at localRepositoryPath and no split
+ // configuration, so they always read it as a flat repository. If the outer build enabled the split
+ // layout (aether.enhancedLocalRepository.split, see the protected
+ // org.eclipse.aether.internal.impl.LocalPathPrefixComposerFactorySupport.CONF_PROP_SPLIT constant,
+ // which is not accessible here), that config would otherwise leak into this cloned session and make
+ // the enhanced local repository manager install artifacts under "installed/..." where the IT build
+ // can never find them (MINVOKER-377).
+ newSession.setConfigProperty("aether.enhancedLocalRepository.split", Boolean.FALSE);
+ getLog().debug("Ignoring any split local repository configuration for the IT local repository");
+
LocalRepositoryManager localRepositoryManager = repositorySystem.newLocalRepositoryManager(
newSession, new LocalRepository(localRepositoryPath, contentType));