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 b8292397b9..207697a4f3 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 @@ -33,7 +33,6 @@ import org.gradle.api.provider.Provider; import org.gradle.api.tasks.SourceSet; import org.gradle.api.tasks.SourceSetContainer; import org.gradle.api.tasks.TaskProvider; -import org.gradle.api.tasks.compile.JavaCompile; import org.springframework.boot.gradle.tasks.aot.AbstractAot; import org.springframework.boot.gradle.tasks.aot.ProcessAot; @@ -123,8 +122,7 @@ public class SpringBootAotPlugin implements Plugin { task.getApplicationClass() .set(resolveMainClassName.flatMap(ResolveMainClassName::readMainClassName)); }); - project.getTasks().named(aotSourceSet.getCompileJavaTaskName(), JavaCompile.class).configure( - (javaCompile) -> javaCompile.setClasspath(javaCompile.getClasspath().plus(project.files(aotClasses)))); + project.getDependencies().add(aotSourceSet.getImplementationConfigurationName(), project.files(aotClasses)); aotSourceSet.getOutput().dir(aotClasses); configureDependsOn(project, aotSourceSet, processAot); }