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/08/26 21:37:27 UTC
(maven) branch master updated: Resolve classified POM artifacts from the reactor [4.x] (#12658)
This is an automated email from the ASF dual-hosted git repository.
gnodet pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/maven.git
The following commit(s) were added to refs/heads/master by this push:
new 14c855ff53 Resolve classified POM artifacts from the reactor [4.x] (#12658)
14c855ff53 is described below
commit 14c855ff53dbbf911631945259d263f37dc1f049
Author: Václav Haisman <vh...@gmail.com>
AuthorDate: Wed Aug 26 23:37:22 2026 +0200
Resolve classified POM artifacts from the reactor [4.x] (#12658)
* Add IT for classified POM reactor resolution
* Resolve classified POM artifacts from reactor
---
.../main/java/org/apache/maven/ReactorReader.java | 5 +-
...ep0590ClassifiedPomArtifactFromReactorTest.java | 49 +++++++++++++++++
.../src/test/resources/mdep-590/consumer/pom.xml | 64 ++++++++++++++++++++++
.../src/test/resources/mdep-590/pom.xml | 35 ++++++++++++
.../test/resources/mdep-590/producer/custom.pom | 20 +++++++
.../src/test/resources/mdep-590/producer/pom.xml | 57 +++++++++++++++++++
6 files changed, 228 insertions(+), 2 deletions(-)
diff --git a/impl/maven-core/src/main/java/org/apache/maven/ReactorReader.java b/impl/maven-core/src/main/java/org/apache/maven/ReactorReader.java
index db4882e386..c1fb482945 100644
--- a/impl/maven-core/src/main/java/org/apache/maven/ReactorReader.java
+++ b/impl/maven-core/src/main/java/org/apache/maven/ReactorReader.java
@@ -159,8 +159,9 @@ public Model findModel(Artifact artifact) {
//
private File findArtifact(MavenProject project, Artifact artifact, boolean checkUptodate) {
- // POMs are always returned from the file system
- if ("pom".equals(artifact.getExtension())) {
+ // Unclassified POMs are always returned from the file system
+ if ("pom".equals(artifact.getExtension())
+ && (artifact.getClassifier() == null || artifact.getClassifier().isEmpty())) {
return project.getFile();
}
diff --git a/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmdep0590ClassifiedPomArtifactFromReactorTest.java b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmdep0590ClassifiedPomArtifactFromReactorTest.java
new file mode 100644
index 0000000000..37d4135ec6
--- /dev/null
+++ b/its/core-it-suite/src/test/java/org/apache/maven/it/MavenITmdep0590ClassifiedPomArtifactFromReactorTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+package org.apache.maven.it;
+
+import java.nio.file.Path;
+import java.util.Properties;
+
+import org.junit.jupiter.api.Test;
+
+/**
+ * Regression test for <a href="https://github.com/apache/maven-dependency-plugin/issues/1024">MDEP-590</a>.
+ */
+class MavenITmdep0590ClassifiedPomArtifactFromReactorTest extends AbstractMavenIntegrationTestCase {
+
+ @Test
+ void classifiedPomShouldResolveToAttachedArtifact() throws Exception {
+ Path testDir = extractResources("mdep-590");
+
+ Verifier verifier = newVerifier(testDir);
+ verifier.setAutoclean(false);
+ verifier.deleteDirectory("consumer/target");
+ verifier.deleteArtifacts("org.apache.maven.its.mdep590");
+ verifier.addCliArgument("validate");
+ verifier.execute();
+ verifier.verifyErrorFreeLog();
+
+ Properties properties = verifier.loadProperties("consumer/target/artifact.properties");
+ ItUtils.assertCanonicalFileEquals(
+ testDir.resolve("producer/custom.pom"),
+ Path.of(properties.getProperty(
+ "org.apache.maven.its.mdep590:producer:pom:custom:1.0-SNAPSHOT")));
+ }
+}
diff --git a/its/core-it-suite/src/test/resources/mdep-590/consumer/pom.xml b/its/core-it-suite/src/test/resources/mdep-590/consumer/pom.xml
new file mode 100644
index 0000000000..f471733c21
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mdep-590/consumer/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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.maven.its.mdep590</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>consumer</artifactId>
+ <packaging>pom</packaging>
+
+ <name>Maven Integration Test :: MDEP-590 :: Consumer</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.plugins</groupId>
+ <artifactId>maven-it-plugin-artifact</artifactId>
+ <version>2.1-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>resolve-classified-pom</id>
+ <goals>
+ <goal>resolve</goal>
+ </goals>
+ <phase>validate</phase>
+ <configuration>
+ <propertiesFile>target/artifact.properties</propertiesFile>
+ <dependencies>
+ <dependency>
+ <groupId>org.apache.maven.its.mdep590</groupId>
+ <artifactId>producer</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <type>pom</type>
+ <classifier>custom</classifier>
+ </dependency>
+ </dependencies>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>
diff --git a/its/core-it-suite/src/test/resources/mdep-590/pom.xml b/its/core-it-suite/src/test/resources/mdep-590/pom.xml
new file mode 100644
index 0000000000..7b6c87ddbe
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mdep-590/pom.xml
@@ -0,0 +1,35 @@
+<?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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>org.apache.maven.its.mdep590</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ <packaging>pom</packaging>
+
+ <name>Maven Integration Test :: MDEP-590</name>
+ <description>Test that a classified POM artifact resolves from the reactor to the attached artifact.</description>
+
+ <modules>
+ <module>producer</module>
+ <module>consumer</module>
+ </modules>
+</project>
diff --git a/its/core-it-suite/src/test/resources/mdep-590/producer/custom.pom b/its/core-it-suite/src/test/resources/mdep-590/producer/custom.pom
new file mode 100644
index 0000000000..31a7f9e36e
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mdep-590/producer/custom.pom
@@ -0,0 +1,20 @@
+<?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.
+-->
+<custom>classified POM artifact</custom>
diff --git a/its/core-it-suite/src/test/resources/mdep-590/producer/pom.xml b/its/core-it-suite/src/test/resources/mdep-590/producer/pom.xml
new file mode 100644
index 0000000000..69d8afa9f0
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mdep-590/producer/pom.xml
@@ -0,0 +1,57 @@
+<?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">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.apache.maven.its.mdep590</groupId>
+ <artifactId>parent</artifactId>
+ <version>1.0-SNAPSHOT</version>
+ </parent>
+
+ <artifactId>producer</artifactId>
+ <packaging>pom</packaging>
+
+ <name>Maven Integration Test :: MDEP-590 :: Producer</name>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.its.plugins</groupId>
+ <artifactId>maven-it-plugin-artifact</artifactId>
+ <version>2.1-SNAPSHOT</version>
+ <executions>
+ <execution>
+ <id>attach-classified-pom</id>
+ <goals>
+ <goal>attach</goal>
+ </goals>
+ <phase>validate</phase>
+ <configuration>
+ <attachedFile>custom.pom</attachedFile>
+ <artifactType>pom</artifactType>
+ <artifactClassifier>custom</artifactClassifier>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+</project>