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 db4882e38696..c1fb48294547 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 000000000000..37d4135ec68c
--- /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 MDEP-590.
+ */
+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 000000000000..f471733c218a
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mdep-590/consumer/pom.xml
@@ -0,0 +1,64 @@
+
+
+
+ 4.0.0
+
+
+ org.apache.maven.its.mdep590
+ parent
+ 1.0-SNAPSHOT
+
+
+ consumer
+ pom
+
+ Maven Integration Test :: MDEP-590 :: Consumer
+
+
+
+
+ org.apache.maven.its.plugins
+ maven-it-plugin-artifact
+ 2.1-SNAPSHOT
+
+
+ resolve-classified-pom
+
+ resolve
+
+ validate
+
+ target/artifact.properties
+
+
+ org.apache.maven.its.mdep590
+ producer
+ 1.0-SNAPSHOT
+ pom
+ custom
+
+
+
+
+
+
+
+
+
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 000000000000..7b6c87ddbe84
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mdep-590/pom.xml
@@ -0,0 +1,35 @@
+
+
+
+ 4.0.0
+
+ org.apache.maven.its.mdep590
+ parent
+ 1.0-SNAPSHOT
+ pom
+
+ Maven Integration Test :: MDEP-590
+ Test that a classified POM artifact resolves from the reactor to the attached artifact.
+
+
+ producer
+ consumer
+
+
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 000000000000..31a7f9e36e12
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mdep-590/producer/custom.pom
@@ -0,0 +1,20 @@
+
+
+classified POM artifact
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 000000000000..69d8afa9f033
--- /dev/null
+++ b/its/core-it-suite/src/test/resources/mdep-590/producer/pom.xml
@@ -0,0 +1,57 @@
+
+
+
+ 4.0.0
+
+
+ org.apache.maven.its.mdep590
+ parent
+ 1.0-SNAPSHOT
+
+
+ producer
+ pom
+
+ Maven Integration Test :: MDEP-590 :: Producer
+
+
+
+
+ org.apache.maven.its.plugins
+ maven-it-plugin-artifact
+ 2.1-SNAPSHOT
+
+
+ attach-classified-pom
+
+ attach
+
+ validate
+
+ custom.pom
+ pom
+ custom
+
+
+
+
+
+
+