From 0bb4c5917222c4f4a6df53bbc70dd770507a3d4d Mon Sep 17 00:00:00 2001 From: Juan Manuel Leflet Estrada Date: Tue, 7 Nov 2023 18:26:48 +0100 Subject: [PATCH] Fix sources goal for multimodule projects Signed-off-by: Juan Manuel Leflet Estrada --- src/it/projects/sources/module-a/pom.xml | 48 +++++++++++++++++++ src/it/projects/sources/module-b/pom.xml | 48 +++++++++++++++++++ src/it/projects/sources/pom.xml | 18 ++++--- .../ResolveDependencySourcesMojo.java | 2 +- 4 files changed, 105 insertions(+), 11 deletions(-) create mode 100644 src/it/projects/sources/module-a/pom.xml create mode 100644 src/it/projects/sources/module-b/pom.xml diff --git a/src/it/projects/sources/module-a/pom.xml b/src/it/projects/sources/module-a/pom.xml new file mode 100644 index 000000000..7c6fe3c1d --- /dev/null +++ b/src/it/projects/sources/module-a/pom.xml @@ -0,0 +1,48 @@ + + + + + 4.0.0 + + + org.apache.maven.its.dependency + tree-multimodule + 1.0-SNAPSHOT + + + MultimoduleTest Module A + + tree-multimodule-module-a + + + UTF-8 + + + + + org.apache.maven + maven-project + 2.0.6 + + + + diff --git a/src/it/projects/sources/module-b/pom.xml b/src/it/projects/sources/module-b/pom.xml new file mode 100644 index 000000000..bffea42af --- /dev/null +++ b/src/it/projects/sources/module-b/pom.xml @@ -0,0 +1,48 @@ + + + + + 4.0.0 + + + org.apache.maven.its.dependency + tree-multimodule + 1.0-SNAPSHOT + + + MultimoduleTest Module B + + tree-multimodule-module-b + + + UTF-8 + + + + + org.apache.maven.its.dependency + tree-multimodule-module-a + ${project.version} + + + + diff --git a/src/it/projects/sources/pom.xml b/src/it/projects/sources/pom.xml index f04fc4d88..062e10d43 100644 --- a/src/it/projects/sources/pom.xml +++ b/src/it/projects/sources/pom.xml @@ -24,24 +24,22 @@ 4.0.0 org.apache.maven.its.dependency - test + tree-multimodule 1.0-SNAPSHOT + pom - Test + MultimoduleTest - Test dependency:sources + Test dependency:tree on multimodule project UTF-8 - - - org.apache.maven - maven-project - 2.0.8 - - + + module-a + module-b + diff --git a/src/main/java/org/apache/maven/plugins/dependency/resolvers/ResolveDependencySourcesMojo.java b/src/main/java/org/apache/maven/plugins/dependency/resolvers/ResolveDependencySourcesMojo.java index 21e8cce3b..f4871de0b 100644 --- a/src/main/java/org/apache/maven/plugins/dependency/resolvers/ResolveDependencySourcesMojo.java +++ b/src/main/java/org/apache/maven/plugins/dependency/resolvers/ResolveDependencySourcesMojo.java @@ -32,7 +32,7 @@ @Mojo( name = "sources", defaultPhase = LifecyclePhase.GENERATE_SOURCES, - requiresDependencyResolution = ResolutionScope.TEST, + requiresDependencyCollection = ResolutionScope.TEST, threadSafe = true) public class ResolveDependencySourcesMojo extends ResolveDependenciesMojo {