From 7249d1f69251e8c7ae4cf379f88be802a14d2eed Mon Sep 17 00:00:00 2001 From: Michael Osipov Date: Sun, 9 Jun 2024 17:33:14 +0200 Subject: [PATCH] [MRELEASE-1148] Release Manager pulls in transitive dependencies This closes #219 --- .../shared/release/phase/GenerateReleasePomsPhase.java | 8 +++++++- .../subproject4/expected-release-pom.xml | 6 ------ .../subproject4/subsubproject/expected-release-pom.xml | 6 ------ 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/GenerateReleasePomsPhase.java b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/GenerateReleasePomsPhase.java index 1261b2547..122a49bd9 100644 --- a/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/GenerateReleasePomsPhase.java +++ b/maven-release-manager/src/main/java/org/apache/maven/shared/release/phase/GenerateReleasePomsPhase.java @@ -459,7 +459,7 @@ private Scm createReleaseScm(Scm scm, ScmTranslator scmTranslator, ReleaseDescri private List createReleaseDependencies(ReleaseDescriptor releaseDescriptor, MavenProject project) throws ReleaseFailureException { - Set artifacts = project.getArtifacts(); + Set artifacts = project.getDependencyArtifacts(); List releaseDependencies = null; @@ -471,6 +471,12 @@ private List createReleaseDependencies(ReleaseDescriptor releaseDesc releaseDependencies = new ArrayList<>(); for (Artifact artifact : orderedArtifacts) { + if (artifact.getVersion() == null) { + artifact.setVersion(project.getArtifactMap() + .get(ArtifactUtils.versionlessKey(artifact)) + .getVersion()); + } + Dependency releaseDependency = new Dependency(); releaseDependency.setGroupId(artifact.getGroupId()); diff --git a/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject4/expected-release-pom.xml b/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject4/expected-release-pom.xml index bf4aba3fb..d2309452a 100644 --- a/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject4/expected-release-pom.xml +++ b/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject4/expected-release-pom.xml @@ -68,12 +68,6 @@ under the License. - - groupId - subproject1 - 1.0 - compile - groupId subproject2 diff --git a/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject4/subsubproject/expected-release-pom.xml b/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject4/subsubproject/expected-release-pom.xml index eaa57e88d..39fc6b8db 100644 --- a/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject4/subsubproject/expected-release-pom.xml +++ b/maven-release-manager/src/test/resources/projects/generate-release-poms/internal-snapshot-dependencies/subproject4/subsubproject/expected-release-pom.xml @@ -64,12 +64,6 @@ under the License. - - groupId - subproject1 - 1.0 - compile - groupId subproject2