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<Dependency> createReleaseDependencies(ReleaseDescriptor releaseDescriptor, MavenProject project) throws ReleaseFailureException { - Set<Artifact> artifacts = project.getArtifacts(); + Set<Artifact> artifacts = project.getDependencyArtifacts(); List<Dependency> releaseDependencies = null; @@ -471,6 +471,12 @@ private List<Dependency> 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. </pluginRepository> </pluginRepositories> <dependencies> - <dependency> - <groupId>groupId</groupId> - <artifactId>subproject1</artifactId> - <version>1.0</version> - <scope>compile</scope> - </dependency> <dependency> <groupId>groupId</groupId> <artifactId>subproject2</artifactId> 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. </pluginRepository> </pluginRepositories> <dependencies> - <dependency> - <groupId>groupId</groupId> - <artifactId>subproject1</artifactId> - <version>1.0</version> - <scope>compile</scope> - </dependency> <dependency> <groupId>groupId</groupId> <artifactId>subproject2</artifactId>