From 1e447ebfbf7522db39db3fc65bb7ddca63cd5928 Mon Sep 17 00:00:00 2001 From: danhyun Date: Mon, 9 Apr 2018 14:14:28 -0700 Subject: [PATCH 1/2] Only analyze configurations that we've registered to check See gh-12784 --- .../boot/gradle/plugin/SpringBootPlugin.java | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SpringBootPlugin.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SpringBootPlugin.java index fe6d16c3df..ed9a8aff95 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SpringBootPlugin.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SpringBootPlugin.java @@ -42,6 +42,7 @@ import org.springframework.boot.gradle.tasks.bundling.BootWar; * @author Phillip Webb * @author Dave Syer * @author Andy Wilkinson + * @author Danny Hyun */ public class SpringBootPlugin implements Plugin { @@ -121,10 +122,14 @@ public class SpringBootPlugin implements Plugin { private void unregisterUnresolvedDependenciesAnalyzer(Project project) { UnresolvedDependenciesAnalyzer unresolvedDependenciesAnalyzer = new UnresolvedDependenciesAnalyzer(); project.getConfigurations().all((configuration) -> configuration.getIncoming() - .afterResolve((resolvableDependencies) -> unresolvedDependenciesAnalyzer - .analyze(configuration.getResolvedConfiguration() - .getLenientConfiguration() - .getUnresolvedModuleDependencies()))); + .afterResolve((resolvableDependencies) -> { + if (configuration.getIncoming().equals(resolvableDependencies)) { + unresolvedDependenciesAnalyzer + .analyze(configuration.getResolvedConfiguration() + .getLenientConfiguration() + .getUnresolvedModuleDependencies()); + } + })); project.getGradle().buildFinished( (buildResult) -> unresolvedDependenciesAnalyzer.buildFinished(project)); } From 72ec2c8644eae1ac3aeb5d8a92c18951a083a76b Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Mon, 23 Apr 2018 16:45:21 +0100 Subject: [PATCH 2/2] =?UTF-8?q?Polish=20=E2=80=9COnly=20analyze=20configur?= =?UTF-8?q?ations=20that=20we've=20registered=20to=20check=E2=80=9D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes gh-12784 --- .../boot/gradle/plugin/SpringBootPlugin.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SpringBootPlugin.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SpringBootPlugin.java index ed9a8aff95..f278410a57 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SpringBootPlugin.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SpringBootPlugin.java @@ -30,6 +30,7 @@ import org.gradle.api.GradleException; import org.gradle.api.Plugin; import org.gradle.api.Project; import org.gradle.api.artifacts.Configuration; +import org.gradle.api.artifacts.ResolvableDependencies; import org.gradle.util.GradleVersion; import org.springframework.boot.gradle.dsl.SpringBootExtension; @@ -121,15 +122,16 @@ public class SpringBootPlugin implements Plugin { private void unregisterUnresolvedDependenciesAnalyzer(Project project) { UnresolvedDependenciesAnalyzer unresolvedDependenciesAnalyzer = new UnresolvedDependenciesAnalyzer(); - project.getConfigurations().all((configuration) -> configuration.getIncoming() - .afterResolve((resolvableDependencies) -> { - if (configuration.getIncoming().equals(resolvableDependencies)) { - unresolvedDependenciesAnalyzer - .analyze(configuration.getResolvedConfiguration() - .getLenientConfiguration() - .getUnresolvedModuleDependencies()); - } - })); + project.getConfigurations().all((configuration) -> { + ResolvableDependencies incoming = configuration.getIncoming(); + incoming.afterResolve((resolvableDependencies) -> { + if (incoming.equals(resolvableDependencies)) { + unresolvedDependenciesAnalyzer.analyze(configuration + .getResolvedConfiguration().getLenientConfiguration() + .getUnresolvedModuleDependencies()); + } + }); + }); project.getGradle().buildFinished( (buildResult) -> unresolvedDependenciesAnalyzer.buildFinished(project)); }