spring-boot/spring-boot-project/spring-boot-tools/spring-boot-maven-plugin/build.gradle
Phillip Webb 8ee20c8dae Migrate maven-plugin to Antora
See gh-33766
2024-03-20 15:21:56 -07:00

172 lines
6.1 KiB
Groovy

plugins {
id "org.antora"
id "org.springframework.boot.conventions"
id "org.springframework.boot.maven-plugin"
id "org.springframework.boot.optional-dependencies"
}
description = "Spring Boot Maven Plugin"
configurations {
dependenciesBom
antoraContent
}
dependencies {
compileOnly("org.apache.maven.plugin-tools:maven-plugin-annotations")
compileOnly("org.sonatype.plexus:plexus-build-api")
compileOnly("org.apache.maven:maven-core") {
exclude(group: "javax.annotation", module: "javax.annotation-api")
exclude(group: "javax.inject", module: "javax.inject")
}
compileOnly("org.apache.maven:maven-plugin-api") {
exclude(group: "javax.annotation", module: "javax.annotation-api")
exclude(group: "javax.enterprise", module: "cdi-api")
exclude(group: "javax.inject", module: "javax.inject")
}
implementation(project(":spring-boot-project:spring-boot-tools:spring-boot-buildpack-platform"))
implementation(project(":spring-boot-project:spring-boot-tools:spring-boot-loader-tools"))
implementation("org.apache.maven.shared:maven-common-artifact-filters") {
exclude(group: "javax.annotation", module: "javax.annotation-api")
exclude(group: "javax.enterprise", module: "cdi-api")
exclude(group: "javax.inject", module: "javax.inject")
}
implementation("org.springframework:spring-core")
implementation("org.springframework:spring-context")
testImplementation("org.apache.maven:maven-core") {
exclude(group: "javax.annotation", module: "javax.annotation-api")
exclude(group: "javax.inject", module: "javax.inject")
}
testImplementation("org.apache.maven.shared:maven-common-artifact-filters") {
exclude(group: "javax.annotation", module: "javax.annotation-api")
exclude(group: "javax.enterprise", module: "cdi-api")
exclude(group: "javax.inject", module: "javax.inject")
}
testImplementation("org.assertj:assertj-core")
testImplementation("org.junit.jupiter:junit-jupiter")
testImplementation("org.mockito:mockito-core")
testImplementation("org.mockito:mockito-junit-jupiter")
testImplementation("org.springframework:spring-core")
intTestImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-buildpack-platform"))
intTestImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-loader-tools"))
intTestImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
intTestImplementation("org.apache.maven.shared:maven-invoker") {
exclude(group: "javax.inject", module: "javax.inject")
}
intTestImplementation("org.assertj:assertj-core")
intTestImplementation("org.junit.jupiter:junit-jupiter")
intTestImplementation("org.testcontainers:testcontainers")
intTestImplementation("org.testcontainers:junit-jupiter")
mavenOptionalImplementation("org.apache.maven.plugins:maven-shade-plugin") {
exclude(group: "javax.annotation", module: "javax.annotation-api")
exclude(group: "javax.enterprise", module: "cdi-api")
exclude(group: "javax.inject", module: "javax.inject")
}
mavenRepository(project(path: ":spring-boot-project:spring-boot", configuration: "mavenRepository"))
mavenRepository(project(path: ":spring-boot-project:spring-boot-test", configuration: "mavenRepository"))
mavenRepository(project(path: ":spring-boot-project:spring-boot-devtools", configuration: "mavenRepository"))
mavenRepository(project(path: ":spring-boot-project:spring-boot-docker-compose", configuration: "mavenRepository"))
runtimeOnly("org.sonatype.plexus:plexus-build-api")
versionProperties(project(path: ":spring-boot-project:spring-boot-dependencies", configuration: "effectiveBom"))
}
ext {
versionElements = version.split("\\.")
xsdVersion = versionElements[0] + "." + versionElements[1]
}
sourceSets {
main {
output.dir("${buildDir}/generated/resources/xsd", builtBy: "xsdResources")
}
intTest {
output.dir("${buildDir}/generated-resources", builtBy: "extractVersionProperties")
}
}
javadoc {
options {
author = true
docTitle = "Spring Boot Maven Plugin ${project.version} API"
encoding = "UTF-8"
memberLevel = "protected"
outputLevel = "quiet"
splitIndex = true
use = true
windowTitle = "Spring Boot Maven Plugin ${project.version} API"
}
}
task xsdResources(type: Sync) {
from "src/main/xsd/layers-${project.ext.xsdVersion}.xsd"
into "${buildDir}/generated/resources/xsd/org/springframework/boot/maven"
rename { fileName -> "layers.xsd" }
}
prepareMavenBinaries {
versions "3.9.0", "3.8.5", "3.6.3"
}
tasks.named("documentPluginGoals") {
goalSections = [
"build-image": "build-image",
"build-image-no-fork": "build-image",
"build-info": "build-info",
"help": "help",
"process-aot": "aot",
"process-test-aot": "aot",
"repackage": "packaging",
"run": "run",
"start": "integration-tests",
"stop": "integration-tests",
"test-run": "run"
]
}
def antoraMavenPluginLocalAggregateContent = tasks.register("antoraMavenPluginLocalAggregateContent", Zip) {
destinationDirectory = layout.buildDirectory.dir('generated/docs/antora-content')
archiveClassifier = "maven-plugin-local-aggregate-content"
from(tasks.getByName("generateAntoraYml")) {
into "modules"
}
}
def antoraMavenPluginAggregateContent = tasks.register("antoraMavenPluginAggregateContent", Zip) {
destinationDirectory = layout.buildDirectory.dir('generated/docs/antora-content')
archiveClassifier = "maven-plugin-aggregate-content"
from(documentPluginGoals) {
into "modules/maven-plugin/partials/goals"
}
}
def antoraMavenPluginCatalogContent = tasks.register("antoraMavenPluginCatalogContent", Zip) {
destinationDirectory = layout.buildDirectory.dir('generated/docs/antora-content')
archiveClassifier = "maven-plugin-catalog-content"
from(javadoc) {
into "api/java"
}
}
tasks.named("generateAntoraPlaybook") {
xrefStubs = ["appendix:.*", "api:.*", "reference:.*"]
alwaysInclude = [name: "maven-plugin", classifier: "local-aggregate-content"]
dependsOn antoraMavenPluginLocalAggregateContent
}
tasks.named("antora") {
inputs.files(antoraMavenPluginLocalAggregateContent, antoraMavenPluginAggregateContent, antoraMavenPluginCatalogContent)
}
artifacts {
antoraContent antoraMavenPluginAggregateContent
antoraContent antoraMavenPluginCatalogContent
}