Skip to content

Commit

Permalink
Don't pull in transitive artifacts
Browse files Browse the repository at this point in the history
With
apache/maven-resolver@f31b36e
MavenProject#getArtifacts() now contains all (incl. transitive) deps.
Use direct deps only otherwise it will even pull in trans test ones.
  • Loading branch information
michael-o committed Jun 9, 2024
1 parent 9a3d9a5 commit d456cbe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit d456cbe

Please sign in to comment.