Skip to content

Commit 8ee20c8

Browse files
committed
Migrate maven-plugin to Antora
See gh-33766
1 parent 18a2b2e commit 8ee20c8

File tree

73 files changed

+334
-315
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+334
-315
lines changed
Lines changed: 57 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id "org.asciidoctor.jvm.convert"
2+
id "org.antora"
33
id "org.springframework.boot.conventions"
44
id "org.springframework.boot.maven-plugin"
55
id "org.springframework.boot.optional-dependencies"
@@ -9,12 +9,10 @@ description = "Spring Boot Maven Plugin"
99

1010
configurations {
1111
dependenciesBom
12-
documentation
12+
antoraContent
1313
}
1414

1515
dependencies {
16-
asciidoctorExtensions("io.spring.asciidoctor:spring-asciidoctor-extensions-section-ids")
17-
1816
compileOnly("org.apache.maven.plugin-tools:maven-plugin-annotations")
1917
compileOnly("org.sonatype.plexus:plexus-build-api")
2018
compileOnly("org.apache.maven:maven-core") {
@@ -37,6 +35,21 @@ dependencies {
3735
implementation("org.springframework:spring-core")
3836
implementation("org.springframework:spring-context")
3937

38+
testImplementation("org.apache.maven:maven-core") {
39+
exclude(group: "javax.annotation", module: "javax.annotation-api")
40+
exclude(group: "javax.inject", module: "javax.inject")
41+
}
42+
testImplementation("org.apache.maven.shared:maven-common-artifact-filters") {
43+
exclude(group: "javax.annotation", module: "javax.annotation-api")
44+
exclude(group: "javax.enterprise", module: "cdi-api")
45+
exclude(group: "javax.inject", module: "javax.inject")
46+
}
47+
testImplementation("org.assertj:assertj-core")
48+
testImplementation("org.junit.jupiter:junit-jupiter")
49+
testImplementation("org.mockito:mockito-core")
50+
testImplementation("org.mockito:mockito-junit-jupiter")
51+
testImplementation("org.springframework:spring-core")
52+
4053
intTestImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-buildpack-platform"))
4154
intTestImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-loader-tools"))
4255
intTestImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
@@ -61,21 +74,6 @@ dependencies {
6174

6275
runtimeOnly("org.sonatype.plexus:plexus-build-api")
6376

64-
testImplementation("org.apache.maven:maven-core") {
65-
exclude(group: "javax.annotation", module: "javax.annotation-api")
66-
exclude(group: "javax.inject", module: "javax.inject")
67-
}
68-
testImplementation("org.apache.maven.shared:maven-common-artifact-filters") {
69-
exclude(group: "javax.annotation", module: "javax.annotation-api")
70-
exclude(group: "javax.enterprise", module: "cdi-api")
71-
exclude(group: "javax.inject", module: "javax.inject")
72-
}
73-
testImplementation("org.assertj:assertj-core")
74-
testImplementation("org.junit.jupiter:junit-jupiter")
75-
testImplementation("org.mockito:mockito-core")
76-
testImplementation("org.mockito:mockito-junit-jupiter")
77-
testImplementation("org.springframework:spring-core")
78-
7977
versionProperties(project(path: ":spring-boot-project:spring-boot-dependencies", configuration: "effectiveBom"))
8078
}
8179

@@ -84,12 +82,6 @@ ext {
8482
xsdVersion = versionElements[0] + "." + versionElements[1]
8583
}
8684

87-
syncDocumentationSourceForAsciidoctor {
88-
from(documentPluginGoals) {
89-
into "asciidoc/goals"
90-
}
91-
}
92-
9385
sourceSets {
9486
main {
9587
output.dir("${buildDir}/generated/resources/xsd", builtBy: "xsdResources")
@@ -99,30 +91,6 @@ sourceSets {
9991
}
10092
}
10193

102-
tasks.withType(org.asciidoctor.gradle.jvm.AbstractAsciidoctorTask) {
103-
doFirst {
104-
attributes "spring-boot-xsd-version" : project.ext.xsdVersion
105-
}
106-
}
107-
108-
asciidoctor {
109-
sources {
110-
include "index.adoc"
111-
}
112-
}
113-
114-
task asciidoctorPdf(type: org.asciidoctor.gradle.jvm.AsciidoctorTask) {
115-
sources {
116-
include "index.adoc"
117-
}
118-
}
119-
120-
syncDocumentationSourceForAsciidoctorPdf {
121-
from(documentPluginGoals) {
122-
into "asciidoc/goals"
123-
}
124-
}
125-
12694
javadoc {
12795
options {
12896
author = true
@@ -136,21 +104,6 @@ javadoc {
136104
}
137105
}
138106

139-
task zip(type: Zip) {
140-
dependsOn asciidoctor, asciidoctorPdf
141-
duplicatesStrategy "fail"
142-
from(asciidoctorPdf.outputDir) {
143-
into "reference/pdf"
144-
rename "index.pdf", "${project.name}-reference.pdf"
145-
}
146-
from(asciidoctor.outputDir) {
147-
into "reference/htmlsingle"
148-
}
149-
from(javadoc) {
150-
into "api"
151-
}
152-
}
153-
154107
task xsdResources(type: Sync) {
155108
from "src/main/xsd/layers-${project.ext.xsdVersion}.xsd"
156109
into "${buildDir}/generated/resources/xsd/org/springframework/boot/maven"
@@ -161,10 +114,6 @@ prepareMavenBinaries {
161114
versions "3.9.0", "3.8.5", "3.6.3"
162115
}
163116

164-
artifacts {
165-
"documentation" zip
166-
}
167-
168117
tasks.named("documentPluginGoals") {
169118
goalSections = [
170119
"build-image": "build-image",
@@ -180,3 +129,43 @@ tasks.named("documentPluginGoals") {
180129
"test-run": "run"
181130
]
182131
}
132+
133+
def antoraMavenPluginLocalAggregateContent = tasks.register("antoraMavenPluginLocalAggregateContent", Zip) {
134+
destinationDirectory = layout.buildDirectory.dir('generated/docs/antora-content')
135+
archiveClassifier = "maven-plugin-local-aggregate-content"
136+
from(tasks.getByName("generateAntoraYml")) {
137+
into "modules"
138+
}
139+
}
140+
141+
def antoraMavenPluginAggregateContent = tasks.register("antoraMavenPluginAggregateContent", Zip) {
142+
destinationDirectory = layout.buildDirectory.dir('generated/docs/antora-content')
143+
archiveClassifier = "maven-plugin-aggregate-content"
144+
from(documentPluginGoals) {
145+
into "modules/maven-plugin/partials/goals"
146+
}
147+
}
148+
149+
def antoraMavenPluginCatalogContent = tasks.register("antoraMavenPluginCatalogContent", Zip) {
150+
destinationDirectory = layout.buildDirectory.dir('generated/docs/antora-content')
151+
archiveClassifier = "maven-plugin-catalog-content"
152+
from(javadoc) {
153+
into "api/java"
154+
}
155+
}
156+
157+
tasks.named("generateAntoraPlaybook") {
158+
xrefStubs = ["appendix:.*", "api:.*", "reference:.*"]
159+
alwaysInclude = [name: "maven-plugin", classifier: "local-aggregate-content"]
160+
dependsOn antoraMavenPluginLocalAggregateContent
161+
}
162+
163+
164+
tasks.named("antora") {
165+
inputs.files(antoraMavenPluginLocalAggregateContent, antoraMavenPluginAggregateContent, antoraMavenPluginCatalogContent)
166+
}
167+
168+
artifacts {
169+
antoraContent antoraMavenPluginAggregateContent
170+
antoraContent antoraMavenPluginCatalogContent
171+
}
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
name: spring-boot
2+
ext:
3+
zip_contents_collector:
4+
include:
5+
- name: maven-plugin
6+
classifier: aggregate-content
7+
- name: maven-plugin
8+
classifier: catalog-content
9+
module: maven-plugin
10+
destination: content-catalog
Lines changed: 1 addition & 0 deletions

0 commit comments

Comments
 (0)