From 6c28156b29a7d8d091d20e99dc7e7fd76cd668e4 Mon Sep 17 00:00:00 2001 From: Andy Wilkinson Date: Fri, 22 Jul 2022 14:14:03 +0100 Subject: [PATCH] Avoid config-time creation of AOT source set's tasks Closes gh-31844 --- .../boot/gradle/plugin/SpringBootAotPlugin.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SpringBootAotPlugin.java b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SpringBootAotPlugin.java index b67b500e27..0ee159bf1c 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SpringBootAotPlugin.java +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/plugin/SpringBootAotPlugin.java @@ -99,10 +99,10 @@ public class SpringBootAotPlugin implements Plugin { task.getGroupId().set(project.provider(() -> String.valueOf(project.getGroup()))); task.getArtifactId().set(project.provider(() -> project.getName())); }); - project.getTasks().getByName(aotSourceSet.getCompileJavaTaskName(), - (compile) -> compile.dependsOn(generateAotSources)); - project.getTasks().getByName(aotSourceSet.getProcessResourcesTaskName(), - (processResources) -> processResources.dependsOn(generateAotSources)); + project.getTasks().named(aotSourceSet.getCompileJavaTaskName()) + .configure((compileJava) -> compileJava.dependsOn(generateAotSources)); + project.getTasks().named(aotSourceSet.getProcessResourcesTaskName()) + .configure((processResources) -> processResources.dependsOn(generateAotSources)); } }