Skip to content

Commit

Permalink
Merge pull request #372 from fp7
Browse files Browse the repository at this point in the history
* gh-372:
  Polish "Don't calculate exclusions for non transitive configurations"
  Don't calculate exclusions for non transitive configurations

Closes gh-372
  • Loading branch information
wilkinsona committed May 2, 2024
2 parents e722715 + dcd1bdf commit 0676dc0
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2014-2023 the original author or authors.
* Copyright 2014-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -78,7 +78,7 @@ class ExclusionConfiguringAction implements Action<ResolvableDependencies> {

@Override
public void execute(ResolvableDependencies resolvableDependencies) {
if (this.dependencyManagementSettings.isApplyMavenExclusions()) {
if (this.configuration.isTransitive() && this.dependencyManagementSettings.isApplyMavenExclusions()) {
applyMavenExclusions(resolvableDependencies);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,14 @@ void whenDependencyIsSubstitutedNewCoordinatesAreUsedForDependencyManagement() {
assertThat(readLines("resolved.txt")).containsExactly("bcprov-jdk18on-1.78.1.jar");
}

@Test
void whenConfigurationIsNotTransitiveExclusionsAreNotCalculated() {
BuildResult result = this.gradleBuild.runner()
.withArguments("dependencies", "--configuration", "nonTransitive")
.build();
assertThat(result.getOutput()).doesNotContain("Error");
}

private void writeLines(Path path, String... lines) {
try {
Path resolvedPath = this.gradleBuild.runner().getProjectDir().toPath().resolve(path);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
plugins {
id("io.spring.dependency-management")
}

repositories {
mavenCentral()
}

configurations {
nonTransitive {
transitive = false
}
}

dependencies {
nonTransitive("org.eclipse.platform:org.eclipse.swt:3.124.100")
}

0 comments on commit 0676dc0

Please sign in to comment.