diff --git a/buildSrc/src/main/java/org/springframework/boot/build/antora/GenerateAntoraPlaybook.java b/buildSrc/src/main/java/org/springframework/boot/build/antora/GenerateAntoraPlaybook.java index f5dd4d80936..42514c24fd6 100644 --- a/buildSrc/src/main/java/org/springframework/boot/build/antora/GenerateAntoraPlaybook.java +++ b/buildSrc/src/main/java/org/springframework/boot/build/antora/GenerateAntoraPlaybook.java @@ -23,6 +23,7 @@ import java.io.InputStream; import java.io.UncheckedIOException; import java.nio.file.Files; import java.nio.file.Path; +import java.util.ArrayList; import java.util.Collections; import java.util.LinkedHashMap; import java.util.LinkedHashSet; @@ -70,6 +71,10 @@ public abstract class GenerateAntoraPlaybook extends DefaultTask { @Optional public abstract MapProperty getAlwaysInclude(); + @Input + @Optional + public abstract Property getExcludeJavadocExtension(); + public GenerateAntoraPlaybook() { setGroup("Documentation"); setDescription("Generates an Antora playbook.yml file for local use"); @@ -94,9 +99,20 @@ public abstract class GenerateAntoraPlaybook extends DefaultTask { addExtensions(data); addSources(data); addDir(data); + filterJavadocExtension(data); return data; } + @SuppressWarnings("unchecked") + private void filterJavadocExtension(Map data) { + if (getExcludeJavadocExtension().getOrElse(Boolean.FALSE)) { + Map asciidoc = (Map) data.get("asciidoc"); + List extensions = new ArrayList<>((List) asciidoc.get("extensions")); + extensions.remove("@springio/asciidoctor-extensions/javadoc-extension"); + asciidoc.put("extensions", extensions); + } + } + @SuppressWarnings("unchecked") private Map loadPlaybookTemplate() throws IOException { try (InputStream resource = getClass().getResourceAsStream("antora-playbook-template.yml")) { diff --git a/buildSrc/src/test/java/org/springframework/boot/build/antora/GenerateAntoraPlaybookTests.java b/buildSrc/src/test/java/org/springframework/boot/build/antora/GenerateAntoraPlaybookTests.java index 4bcaed2e274..c996fdcb998 100644 --- a/buildSrc/src/test/java/org/springframework/boot/build/antora/GenerateAntoraPlaybookTests.java +++ b/buildSrc/src/test/java/org/springframework/boot/build/antora/GenerateAntoraPlaybookTests.java @@ -54,6 +54,18 @@ class GenerateAntoraPlaybookTests { assertThat(actual.replace('\\', '/')).isEqualToNormalizingNewlines(expected.replace('\\', '/')); } + @Test + void writePlaybookWhenHasJavadocExcludeGeneratesExpectedContent() throws Exception { + writePlaybookYml((task) -> { + task.getXrefStubs().addAll("appendix:.*", "api:.*", "reference:.*"); + task.getAlwaysInclude().set(Map.of("name", "test", "classifier", "local-aggregate-content")); + task.getExcludeJavadocExtension().set(true); + }); + String actual = Files.readString(this.temp.toPath() + .resolve("rootproject/project/build/generated/docs/antora-playbook/antora-playbook.yml")); + assertThat(actual).doesNotContain("javadoc-extension"); + } + private void writePlaybookYml(ThrowingConsumer customizer) throws Exception { File rootProjectDir = new File(this.temp, "rootproject").getCanonicalFile(); rootProjectDir.mkdirs(); diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle index 02430dcba4b..43400fa00f4 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/build.gradle @@ -127,6 +127,7 @@ def antoraGradlePluginCatalogContent = tasks.register("antoraGradlePluginCatalog tasks.named("generateAntoraPlaybook") { xrefStubs = ["appendix:.*", "api:.*", "reference:.*"] + excludeJavadocExtension = true alwaysInclude = [name: "gradle-plugin", classifier: "local-aggregate-content"] dependsOn antoraGradlePluginLocalAggregateContent } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/antora/modules/gradle-plugin/pages/packaging-oci-image.adoc b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/antora/modules/gradle-plugin/pages/packaging-oci-image.adoc index 0738112f8bc..1e8f22f04c6 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/antora/modules/gradle-plugin/pages/packaging-oci-image.adoc +++ b/spring-boot-project/spring-boot-tools/spring-boot-gradle-plugin/src/docs/antora/modules/gradle-plugin/pages/packaging-oci-image.adoc @@ -133,12 +133,12 @@ The following table summarizes the available properties and their default values | `imageName` | `--imageName` -| xref:api:java/org/springframework/boot/buildpack/platform/docker/type/ImageReference.html#of-java.lang.String-[Image name] for the generated image. +| javadoc:org.springframework.boot.buildpack.platform.docker.type.ImageReference#of-java.lang.String-[Image name] for the generated image. | `docker.io/library/${project.name}:${project.version}` | `pullPolicy` | `--pullPolicy` -| xref:api:java/org/springframework/boot/buildpack/platform/build/PullPolicy.html[Policy] used to determine when to pull the builder and run images from the registry. +| javadoc:org.springframework.boot.buildpack.platform.build.PullPolicy[Policy] used to determine when to pull the builder and run images from the registry. Acceptable values are `ALWAYS`, `NEVER`, and `IF_NOT_PRESENT`. | `ALWAYS` diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/build.gradle b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/build.gradle index 1a8eeedef10..1a734d6a7bf 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/build.gradle +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/build.gradle @@ -167,6 +167,7 @@ def antoraMavenPluginCatalogContent = tasks.register("antoraMavenPluginCatalogCo tasks.named("generateAntoraPlaybook") { xrefStubs = ["appendix:.*", "api:.*", "reference:.*", "how-to:.*"] + excludeJavadocExtension = true alwaysInclude = [name: "maven-plugin", classifier: "local-aggregate-content"] dependsOn antoraMavenPluginLocalAggregateContent } diff --git a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/antora/modules/maven-plugin/pages/build-image.adoc b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/antora/modules/maven-plugin/pages/build-image.adoc index c0772e5465e..16683a14be1 100644 --- a/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/antora/modules/maven-plugin/pages/build-image.adoc +++ b/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/src/docs/antora/modules/maven-plugin/pages/build-image.adoc @@ -149,13 +149,13 @@ The following table summarizes the available parameters and their default values | `name` + (`spring-boot.build-image.imageName`) -| xref:api:java/org/springframework/boot/buildpack/platform/docker/type/ImageReference.html#of-java.lang.String-[Image name] for the generated image. +| javadoc:org.springframework.boot.buildpack.platform.docker.type.ImageName#of-java.lang.String-[Image name] for the generated image. | `docker.io/library/` + `${project.artifactId}:${project.version}` | `pullPolicy` + (`spring-boot.build-image.pullPolicy`) -| xref:api:java/org/springframework/boot/buildpack/platform/build/PullPolicy.html[Policy] used to determine when to pull the builder and run images from the registry. +| javadoc:org.springframework.boot.buildpack.platform.build.PullPolicy[Policy] used to determine when to pull the builder and run images from the registry. Acceptable values are `ALWAYS`, `NEVER`, and `IF_NOT_PRESENT`. | `ALWAYS`