diff --git a/buildSrc/src/main/java/org/springframework/boot/build/AntoraConventions.java b/buildSrc/src/main/java/org/springframework/boot/build/AntoraConventions.java index a05289a4a220..841afc509985 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/AntoraConventions.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/AntoraConventions.java @@ -37,6 +37,7 @@ import org.gradle.api.Project; import org.gradle.api.logging.LogLevel; import org.gradle.api.plugins.JavaBasePlugin; +import org.gradle.api.provider.Provider; import org.gradle.api.tasks.Copy; import org.gradle.api.tasks.TaskContainer; @@ -118,8 +119,7 @@ private void configureGenerateAntoraYmlTask(Project project, GenerateAntoraYmlTa generateAntoraYmlTask.setProperty("outputFile", new File(project.getBuildDir(), "generated/docs/antora-yml/antora.yml")); generateAntoraYmlTask.setProperty("yml", getDefaultYml(project)); - generateAntoraYmlTask.doFirst((task) -> generateAntoraYmlTask.getAsciidocAttributes() - .putAll(project.provider(() -> getAsciidocAttributes(project, dependencyVersionsTask)))); + generateAntoraYmlTask.getAsciidocAttributes().putAll(getAsciidocAttributes(project, dependencyVersionsTask)); } private Map getDefaultYml(Project project) { @@ -138,12 +138,14 @@ private void configureGenerateAntoraYmlTask(Project project, GenerateAntoraYmlTa return defaultYml; } - private Map getAsciidocAttributes(Project project, + private Provider> getAsciidocAttributes(Project project, ExtractVersionConstraints dependencyVersionsTask) { - BomExtension bom = (BomExtension) project.project(DEPENDENCIES_PATH).getExtensions().getByName("bom"); - Map dependencyVersions = dependencyVersionsTask.getVersionConstraints(); - AntoraAsciidocAttributes attributes = new AntoraAsciidocAttributes(project, bom, dependencyVersions); - return attributes.get(); + return project.provider(() -> { + BomExtension bom = (BomExtension) project.project(DEPENDENCIES_PATH).getExtensions().getByName("bom"); + Map dependencyVersions = dependencyVersionsTask.getVersionConstraints(); + AntoraAsciidocAttributes attributes = new AntoraAsciidocAttributes(project, bom, dependencyVersions); + return attributes.get(); + }); } private void configureAntoraTask(Project project, AntoraTask antoraTask, NpmInstallTask npmInstallTask,