diff --git a/src/it/projects/mdep-592-addparentpoms-custom-repo/invoker.properties b/src/it/projects/mdep-592-addparentpoms-custom-repo/invoker.properties
new file mode 100644
index 000000000..a644cb7ee
--- /dev/null
+++ b/src/it/projects/mdep-592-addparentpoms-custom-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 = clean package
diff --git a/src/it/projects/mdep-592-addparentpoms-custom-repo/pom.xml b/src/it/projects/mdep-592-addparentpoms-custom-repo/pom.xml
new file mode 100644
index 000000000..1ec6ecf30
--- /dev/null
+++ b/src/it/projects/mdep-592-addparentpoms-custom-repo/pom.xml
@@ -0,0 +1,95 @@
+
+
+
+
+
+
+ 4.0.0
+
+ org.apache.maven.its.dependency
+ test
+ 1.0-SNAPSHOT
+
+ Test MDEP-592
+
+ Test for MDEP-592: addParentPoms=true causes repositories to be ignored.
+
+ This test verifies that when using copy-dependencies with addParentPoms=true,
+ the plugin correctly uses the project's configured remote repositories to resolve
+ parent POMs. The test dependency (test-child) has a parent POM (test-parent) that
+ is only available in a custom repository (fake-remote-repository, not Maven Central).
+
+ CRITICAL: This test uses repository id "fake-remote-repository" which is explicitly
+ excluded from MRM mirroring in src/it/mrm/settings.xml. This ensures the repository
+ is ONLY available if properly propagated via setRemoteRepositories().
+
+ Without the fix, the parent POM resolution would fail because the custom repository
+ would not be propagated to the ProjectBuildingRequest.
+
+
+
+ UTF-8
+
+
+
+
+ fake-remote-repository
+ file:///${basedir}/repo/
+
+ ignore
+
+
+
+
+
+
+ org.apache.maven.its.mdep592
+ test-child
+ 1.0
+
+
+
+
+
+
+ maven-dependency-plugin
+ @project.version@
+
+
+ test-addparentpoms
+
+ copy-dependencies
+
+ package
+
+ ${project.build.directory}/dependencies
+ true
+ true
+ true
+
+
+
+
+
+
+
+
diff --git a/src/it/projects/mdep-592-addparentpoms-custom-repo/repo/org/apache/maven/its/mdep592/test-child/1.0/test-child-1.0.jar b/src/it/projects/mdep-592-addparentpoms-custom-repo/repo/org/apache/maven/its/mdep592/test-child/1.0/test-child-1.0.jar
new file mode 100644
index 000000000..fb6dc6a70
Binary files /dev/null and b/src/it/projects/mdep-592-addparentpoms-custom-repo/repo/org/apache/maven/its/mdep592/test-child/1.0/test-child-1.0.jar differ
diff --git a/src/it/projects/mdep-592-addparentpoms-custom-repo/repo/org/apache/maven/its/mdep592/test-child/1.0/test-child-1.0.pom b/src/it/projects/mdep-592-addparentpoms-custom-repo/repo/org/apache/maven/its/mdep592/test-child/1.0/test-child-1.0.pom
new file mode 100644
index 000000000..9fda05651
--- /dev/null
+++ b/src/it/projects/mdep-592-addparentpoms-custom-repo/repo/org/apache/maven/its/mdep592/test-child/1.0/test-child-1.0.pom
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+ 4.0.0
+
+
+ org.apache.maven.its.mdep592
+ test-parent
+ 1.0
+
+
+ test-child
+
+ Test Child for MDEP-592
+
+ Child artifact for testing MDEP-592. This artifact has a parent POM that is only
+ available in a custom repository. The test verifies that addParentPoms=true correctly
+ uses the configured repository to resolve the parent.
+
+
+
diff --git a/src/it/projects/mdep-592-addparentpoms-custom-repo/repo/org/apache/maven/its/mdep592/test-parent/1.0/test-parent-1.0.pom b/src/it/projects/mdep-592-addparentpoms-custom-repo/repo/org/apache/maven/its/mdep592/test-parent/1.0/test-parent-1.0.pom
new file mode 100644
index 000000000..1a316bbaf
--- /dev/null
+++ b/src/it/projects/mdep-592-addparentpoms-custom-repo/repo/org/apache/maven/its/mdep592/test-parent/1.0/test-parent-1.0.pom
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+ 4.0.0
+
+ org.apache.maven.its.mdep592
+ test-parent
+ 1.0
+ pom
+
+ Test Parent for MDEP-592
+
+ Minimal parent POM for testing MDEP-592: addParentPoms=true causes repositories to be ignored.
+ This parent POM is only available in a custom repository, not Maven Central.
+
+
+
diff --git a/src/it/projects/mdep-592-addparentpoms-custom-repo/setup.bsh b/src/it/projects/mdep-592-addparentpoms-custom-repo/setup.bsh
new file mode 100644
index 000000000..bffff2276
--- /dev/null
+++ b/src/it/projects/mdep-592-addparentpoms-custom-repo/setup.bsh
@@ -0,0 +1,44 @@
+/*
+ * 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.*;
+import org.codehaus.plexus.util.*;
+
+// Clean up test artifacts from local repository to ensure fresh test
+// This forces Maven to download artifacts from the fake-remote-repository
+// rather than using cached versions
+String[] foldersToDelete = {
+ "org/apache/maven/its/mdep592/test-parent",
+ "org/apache/maven/its/mdep592/test-child"
+};
+
+try
+{
+ for ( String folderToDelete : foldersToDelete )
+ {
+ FileUtils.deleteDirectory( new File( localRepositoryPath, folderToDelete ) );
+ }
+}
+catch( IOException e )
+{
+ e.printStackTrace();
+ return false;
+}
+
+return true;
diff --git a/src/it/projects/mdep-592-addparentpoms-custom-repo/verify.bsh b/src/it/projects/mdep-592-addparentpoms-custom-repo/verify.bsh
new file mode 100644
index 000000000..207d759f1
--- /dev/null
+++ b/src/it/projects/mdep-592-addparentpoms-custom-repo/verify.bsh
@@ -0,0 +1,42 @@
+/*
+ * 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.*;
+
+File outputDir = new File( basedir, "target/dependencies" );
+
+String[] expectedFiles = {
+ "org/apache/maven/its/mdep592/test-child/1.0/test-child-1.0.jar",
+ "org/apache/maven/its/mdep592/test-child/1.0/test-child-1.0.pom",
+ // CRITICAL TEST for MDEP-592: Parent POM from custom repository
+ // Without the fix, this file would be missing because the custom repository
+ // would not be propagated to the ProjectBuildingRequest
+ "org/apache/maven/its/mdep592/test-parent/1.0/test-parent-1.0.pom"
+};
+
+for ( String expectedFile : expectedFiles )
+{
+ File file = new File( outputDir, expectedFile );
+ if ( !file.isFile() )
+ {
+ throw new Exception( "Missing file " + file );
+ }
+}
+
+return true;
diff --git a/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/AbstractDependencyFilterMojo.java b/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/AbstractDependencyFilterMojo.java
index b14f0113d..de605f1aa 100644
--- a/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/AbstractDependencyFilterMojo.java
+++ b/src/main/java/org/apache/maven/plugins/dependency/fromDependencies/AbstractDependencyFilterMojo.java
@@ -381,9 +381,10 @@ private MavenProject buildProjectFromArtifact(Artifact artifact) throws MojoExec
ProjectBuildingRequest buildingRequest =
new DefaultProjectBuildingRequest(session.getProjectBuildingRequest());
buildingRequest.setProcessPlugins(false);
+ buildingRequest.setRemoteRepositories(getProject().getRemoteArtifactRepositories());
return projectBuilder.build(artifact, buildingRequest).getProject();
} catch (ProjectBuildingException e) {
- throw new MojoExecutionException("Coud not build project for " + artifact.getId(), e);
+ throw new MojoExecutionException("Could not build project for " + artifact.getId(), e);
}
}