Skip to content

Commit abfed6e

Browse files
committed
Merge pull request #23435 from celcius112
* gh-23435: Configure the bootBuildInfo task lazily Closes gh-23435
2 parents ad6de10 + e95bcfa commit abfed6e

File tree

1 file changed

+5
-5
lines changed
  • spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/dsl

1 file changed

+5
-5
lines changed

spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/main/java/org/springframework/boot/gradle/dsl/SpringBootExtension.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,16 +96,16 @@ public void buildInfo(Action<BuildInfo> configurer) {
9696
TaskProvider<BuildInfo> bootBuildInfo = tasks.register("bootBuildInfo", BuildInfo.class,
9797
this::configureBuildInfoTask);
9898
this.project.getPlugins().withType(JavaPlugin.class, (plugin) -> {
99-
tasks.getByName(JavaPlugin.CLASSES_TASK_NAME).dependsOn(bootBuildInfo.get());
100-
this.project.afterEvaluate((evaluated) -> {
101-
BuildInfoProperties properties = bootBuildInfo.get().getProperties();
99+
tasks.named(JavaPlugin.CLASSES_TASK_NAME).configure((task) -> task.dependsOn(bootBuildInfo));
100+
this.project.afterEvaluate((evaluated) -> bootBuildInfo.configure((buildInfo) -> {
101+
BuildInfoProperties properties = buildInfo.getProperties();
102102
if (properties.getArtifact() == null) {
103103
properties.setArtifact(determineArtifactBaseName());
104104
}
105-
});
105+
}));
106106
});
107107
if (configurer != null) {
108-
configurer.execute(bootBuildInfo.get());
108+
bootBuildInfo.configure(configurer);
109109
}
110110
}
111111

0 commit comments

Comments
 (0)