Skip to content

Commit 0676dc0

Browse files
committed
Merge pull request #372 from fp7
* gh-372: Polish "Don't calculate exclusions for non transitive configurations" Don't calculate exclusions for non transitive configurations Closes gh-372
2 parents e722715 + dcd1bdf commit 0676dc0

File tree

3 files changed

+27
-2
lines changed

3 files changed

+27
-2
lines changed

src/main/java/io/spring/gradle/dependencymanagement/internal/ExclusionConfiguringAction.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2014-2023 the original author or authors.
2+
* Copyright 2014-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -78,7 +78,7 @@ class ExclusionConfiguringAction implements Action<ResolvableDependencies> {
7878

7979
@Override
8080
public void execute(ResolvableDependencies resolvableDependencies) {
81-
if (this.dependencyManagementSettings.isApplyMavenExclusions()) {
81+
if (this.configuration.isTransitive() && this.dependencyManagementSettings.isApplyMavenExclusions()) {
8282
applyMavenExclusions(resolvableDependencies);
8383
}
8484
}

src/test/java/io/spring/gradle/dependencymanagement/DependencyManagementPluginIntegrationTests.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,14 @@ void whenDependencyIsSubstitutedNewCoordinatesAreUsedForDependencyManagement() {
530530
assertThat(readLines("resolved.txt")).containsExactly("bcprov-jdk18on-1.78.1.jar");
531531
}
532532

533+
@Test
534+
void whenConfigurationIsNotTransitiveExclusionsAreNotCalculated() {
535+
BuildResult result = this.gradleBuild.runner()
536+
.withArguments("dependencies", "--configuration", "nonTransitive")
537+
.build();
538+
assertThat(result.getOutput()).doesNotContain("Error");
539+
}
540+
533541
private void writeLines(Path path, String... lines) {
534542
try {
535543
Path resolvedPath = this.gradleBuild.runner().getProjectDir().toPath().resolve(path);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
plugins {
2+
id("io.spring.dependency-management")
3+
}
4+
5+
repositories {
6+
mavenCentral()
7+
}
8+
9+
configurations {
10+
nonTransitive {
11+
transitive = false
12+
}
13+
}
14+
15+
dependencies {
16+
nonTransitive("org.eclipse.platform:org.eclipse.swt:3.124.100")
17+
}

0 commit comments

Comments
 (0)