Skip to content

Commit

Permalink
Test refined exclusion handling with dependency that uses GMM
Browse files Browse the repository at this point in the history
This is a follow-on to cf49bef and adds a test that verifies the
behavior when a dependency has Gradle module metadata and in this
metadata that is a dependency upon a platform.

See gh-360
  • Loading branch information
wilkinsona committed Jul 13, 2023
1 parent cf49bef commit b36e4a0
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,14 @@ void resolutionSucceedsWhenDependencyReliesOnDependencyManagementFromItsAncestor
"spring-core-5.3.27.jar", "spring-jcl-5.3.27.jar");
}

@Test
void resolutionSucceedsWhenDependencyReliesOnConstraintsFromPlatformDependencies() {
this.gradleBuild.runner().withArguments("resolve").build();
assertThat(readLines("resolved.txt")).containsExactly("guava-32.1.1-jre.jar", "failureaccess-1.0.1.jar",
"jsr305-3.0.2.jar", "checker-qual-3.33.0.jar", "error_prone_annotations-2.18.0.jar",
"j2objc-annotations-2.8.jar");
}

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,21 @@
plugins {
id "java"
id "io.spring.dependency-management"
}

repositories {
mavenCentral()
}

dependencies {
implementation("com.google.guava:guava:32.1.1-jre");
}

tasks.register("resolve") {
doFirst {
def files = project.configurations.compileClasspath.resolve()
def output = new File("${buildDir}/resolved.txt")
output.parentFile.mkdirs()
files.collect { it.name }.each { output << "${it}\n" }
}
}

0 comments on commit b36e4a0

Please sign in to comment.