Skip to content

Commit e95bcfa

Browse files
celcius112wilkinsona
authored andcommitted
Configure the bootBuildInfo task lazily
Prior to this commit, the bootBuildInfo was configured eagerly. Configuring it lazily prevent this task from being configured when not explicitly needed. Also, the 'classes' and 'bootJar' tasks are now lazily configured, as the bootBuildInfo task was causing them to be configured eagerly. See gh-23435
1 parent ad6de10 commit e95bcfa

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)