mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
402 lines
18 KiB
Groovy
402 lines
18 KiB
Groovy
plugins {
|
|
id "java"
|
|
id "org.antora"
|
|
id "org.springframework.boot.conventions"
|
|
id "org.springframework.boot.deployed"
|
|
id 'org.jetbrains.kotlin.jvm'
|
|
}
|
|
|
|
description = "Spring Boot Docs"
|
|
|
|
configurations {
|
|
autoConfiguration
|
|
configurationProperties
|
|
remoteSpringApplicationExample
|
|
springApplicationExample
|
|
testSlices
|
|
antoraContent
|
|
all {
|
|
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
|
|
if (details.requested.module.group == "org.apache.kafka" && details.requested.module.name == "kafka-server-common") {
|
|
details.artifactSelection {
|
|
selectArtifact(DependencyArtifact.DEFAULT_TYPE, null, null)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
jar {
|
|
enabled = false
|
|
}
|
|
|
|
javadoc {
|
|
enabled = false
|
|
}
|
|
|
|
javadocJar {
|
|
enabled = false
|
|
}
|
|
|
|
sourcesJar {
|
|
enabled = false
|
|
}
|
|
|
|
plugins.withType(EclipsePlugin) {
|
|
extensions.getByType(org.gradle.plugins.ide.eclipse.model.EclipseModel).classpath { classpath ->
|
|
classpath.plusConfigurations.add(configurations.getByName(sourceSets.main.runtimeClasspathConfigurationName))
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
autoConfiguration(project(path: ":spring-boot-project:spring-boot-autoconfigure", configuration: "autoConfigurationMetadata"))
|
|
autoConfiguration(project(path: ":spring-boot-project:spring-boot-actuator-autoconfigure", configuration: "autoConfigurationMetadata"))
|
|
autoConfiguration(project(path: ":spring-boot-project:spring-boot-devtools", configuration: "autoConfigurationMetadata"))
|
|
autoConfiguration(project(path: ":spring-boot-project:spring-boot-testcontainers", configuration: "autoConfigurationMetadata"))
|
|
|
|
configurationProperties(project(path: ":spring-boot-project:spring-boot", configuration: "configurationPropertiesMetadata"))
|
|
configurationProperties(project(path: ":spring-boot-project:spring-boot-actuator", configuration: "configurationPropertiesMetadata"))
|
|
configurationProperties(project(path: ":spring-boot-project:spring-boot-actuator-autoconfigure", configuration: "configurationPropertiesMetadata"))
|
|
configurationProperties(project(path: ":spring-boot-project:spring-boot-autoconfigure", configuration: "configurationPropertiesMetadata"))
|
|
configurationProperties(project(path: ":spring-boot-project:spring-boot-docker-compose", configuration: "configurationPropertiesMetadata"))
|
|
configurationProperties(project(path: ":spring-boot-project:spring-boot-devtools", configuration: "configurationPropertiesMetadata"))
|
|
configurationProperties(project(path: ":spring-boot-project:spring-boot-test-autoconfigure", configuration: "configurationPropertiesMetadata"))
|
|
configurationProperties(project(path: ":spring-boot-project:spring-boot-testcontainers", configuration: "configurationPropertiesMetadata"))
|
|
|
|
dokkatoo(project(path: ":spring-boot-project:spring-boot"))
|
|
dokkatoo(project(path: ":spring-boot-project:spring-boot-test"))
|
|
|
|
implementation(project(path: ":spring-boot-project:spring-boot-actuator"))
|
|
implementation(project(path: ":spring-boot-project:spring-boot-actuator-autoconfigure"))
|
|
implementation(project(path: ":spring-boot-project:spring-boot-autoconfigure"))
|
|
implementation(project(path: ":spring-boot-project:spring-boot-docker-compose"))
|
|
implementation(project(path: ":spring-boot-project:spring-boot-tools:spring-boot-cli"))
|
|
implementation(project(path: ":spring-boot-project:spring-boot-tools:spring-boot-loader-tools"))
|
|
implementation(project(path: ":spring-boot-project:spring-boot-test"))
|
|
implementation(project(path: ":spring-boot-project:spring-boot-test-autoconfigure"))
|
|
implementation(project(path: ":spring-boot-project:spring-boot-testcontainers"))
|
|
implementation(project(path: ":spring-boot-project:spring-boot-devtools"))
|
|
implementation("ch.qos.logback:logback-classic")
|
|
implementation("com.zaxxer:HikariCP")
|
|
implementation("io.micrometer:micrometer-jakarta9")
|
|
implementation("io.micrometer:micrometer-tracing")
|
|
implementation("io.micrometer:micrometer-registry-graphite")
|
|
implementation("io.micrometer:micrometer-registry-jmx")
|
|
implementation("io.projectreactor.netty:reactor-netty-http")
|
|
implementation("io.undertow:undertow-core")
|
|
implementation("jakarta.annotation:jakarta.annotation-api")
|
|
implementation("jakarta.jms:jakarta.jms-api")
|
|
implementation("jakarta.persistence:jakarta.persistence-api")
|
|
implementation("jakarta.servlet:jakarta.servlet-api")
|
|
implementation("jakarta.validation:jakarta.validation-api")
|
|
implementation("org.apache.httpcomponents.client5:httpclient5")
|
|
implementation("org.apache.commons:commons-dbcp2") {
|
|
exclude group: "commons-logging", module: "commons-logging"
|
|
}
|
|
implementation("org.apache.kafka:kafka-streams")
|
|
implementation("org.apache.logging.log4j:log4j-to-slf4j")
|
|
implementation("org.apache.tomcat.embed:tomcat-embed-core")
|
|
implementation("org.assertj:assertj-core")
|
|
implementation("org.cache2k:cache2k-spring")
|
|
implementation("org.apache.groovy:groovy")
|
|
implementation("org.glassfish.jersey.containers:jersey-container-servlet-core")
|
|
implementation("org.glassfish.jersey.core:jersey-server")
|
|
implementation("org.hibernate.orm:hibernate-jcache") {
|
|
exclude group: "javax.activation", module: "javax.activation-api"
|
|
exclude group: "javax.persistence", module: "javax.persistence-api"
|
|
exclude group: "javax.xml.bind", module: "jaxb-api"
|
|
exclude group: "org.jboss.spec.javax.transaction", module: "jboss-transaction-api_1.2_spec"
|
|
}
|
|
implementation("org.htmlunit:htmlunit") {
|
|
exclude group: "commons-logging", module: "commons-logging"
|
|
exclude group: "xml-apis", module: "xml-apis"
|
|
}
|
|
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8")
|
|
implementation("org.jooq:jooq") {
|
|
exclude group: "javax.xml.bind", module: "jaxb-api"
|
|
}
|
|
implementation("org.mockito:mockito-core")
|
|
implementation("org.mongodb:mongodb-driver-sync")
|
|
implementation("org.postgresql:r2dbc-postgresql")
|
|
implementation("org.quartz-scheduler:quartz")
|
|
implementation("org.slf4j:jul-to-slf4j")
|
|
implementation("org.springframework:spring-jdbc")
|
|
implementation("org.springframework:spring-jms")
|
|
implementation("org.springframework:spring-orm")
|
|
implementation("org.springframework:spring-test")
|
|
implementation("org.springframework:spring-web")
|
|
implementation("org.springframework:spring-webflux")
|
|
implementation("org.springframework:spring-webmvc")
|
|
implementation("org.springframework:spring-websocket")
|
|
implementation("org.springframework.amqp:spring-amqp")
|
|
implementation("org.springframework.amqp:spring-rabbit")
|
|
implementation("org.springframework.batch:spring-batch-core")
|
|
implementation("org.springframework.data:spring-data-cassandra")
|
|
implementation("org.springframework.data:spring-data-couchbase")
|
|
implementation("org.springframework.data:spring-data-elasticsearch") {
|
|
exclude group: "commons-logging", module: "commons-logging"
|
|
}
|
|
implementation("org.springframework.data:spring-data-envers") {
|
|
exclude group: "javax.activation", module: "javax.activation-api"
|
|
exclude group: "javax.persistence", module: "javax.persistence-api"
|
|
exclude group: "javax.xml.bind", module: "jaxb-api"
|
|
exclude group: "org.jboss.spec.javax.transaction", module: "jboss-transaction-api_1.2_spec"
|
|
}
|
|
implementation("org.springframework.data:spring-data-jpa")
|
|
implementation("org.springframework.data:spring-data-ldap")
|
|
implementation("org.springframework.data:spring-data-mongodb")
|
|
implementation("org.springframework.data:spring-data-neo4j")
|
|
implementation("org.springframework.data:spring-data-redis")
|
|
implementation("org.springframework.data:spring-data-r2dbc")
|
|
implementation("org.springframework.graphql:spring-graphql")
|
|
implementation("org.springframework.graphql:spring-graphql-test")
|
|
implementation("org.springframework.kafka:spring-kafka")
|
|
implementation("org.springframework.kafka:spring-kafka-test") {
|
|
exclude group: "commons-logging", module: "commons-logging"
|
|
}
|
|
implementation("org.springframework.pulsar:spring-pulsar")
|
|
implementation("org.springframework.pulsar:spring-pulsar-reactive")
|
|
implementation("org.springframework.restdocs:spring-restdocs-mockmvc")
|
|
implementation("org.springframework.restdocs:spring-restdocs-restassured")
|
|
implementation("org.springframework.restdocs:spring-restdocs-webtestclient")
|
|
implementation("org.springframework.security:spring-security-config")
|
|
implementation("org.springframework.security:spring-security-oauth2-client")
|
|
implementation("org.springframework.security:spring-security-test")
|
|
implementation("org.springframework.security:spring-security-web")
|
|
implementation("org.springframework.ws:spring-ws-core")
|
|
implementation("org.springframework.ws:spring-ws-test")
|
|
implementation("org.testcontainers:junit-jupiter")
|
|
implementation("org.testcontainers:neo4j")
|
|
implementation("org.testcontainers:mongodb")
|
|
implementation("org.junit.jupiter:junit-jupiter")
|
|
implementation("org.yaml:snakeyaml")
|
|
|
|
remoteSpringApplicationExample(platform(project(":spring-boot-project:spring-boot-dependencies")))
|
|
remoteSpringApplicationExample(project(":spring-boot-project:spring-boot-devtools"))
|
|
remoteSpringApplicationExample(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-logging"))
|
|
remoteSpringApplicationExample("org.springframework:spring-web")
|
|
|
|
springApplicationExample(platform(project(":spring-boot-project:spring-boot-dependencies")))
|
|
springApplicationExample(project(path: ":spring-boot-project:spring-boot-starters:spring-boot-starter-web"))
|
|
|
|
antoraContent(project(path: ":spring-boot-project:spring-boot-actuator-autoconfigure", configuration: "antoraContent"))
|
|
antoraContent(project(path: ":spring-boot-project:spring-boot-tools:spring-boot-gradle-plugin", configuration: "antoraContent"))
|
|
antoraContent(project(path: ":spring-boot-project:spring-boot-tools:spring-boot-maven-plugin", configuration: "antoraContent"))
|
|
|
|
testImplementation(project(":spring-boot-project:spring-boot-actuator-autoconfigure"))
|
|
testImplementation(project(":spring-boot-project:spring-boot-tools:spring-boot-test-support"))
|
|
testImplementation("org.assertj:assertj-core")
|
|
testImplementation("org.junit.jupiter:junit-jupiter")
|
|
|
|
testRuntimeOnly(project(":spring-boot-project:spring-boot-starters:spring-boot-starter-web"))
|
|
testRuntimeOnly("com.h2database:h2")
|
|
testRuntimeOnly("org.springframework:spring-jdbc")
|
|
|
|
testSlices(project(path: ":spring-boot-project:spring-boot-test-autoconfigure", configuration: "testSliceMetadata"))
|
|
}
|
|
|
|
dokkatoo {
|
|
moduleName.set("Spring Boot Kotlin API")
|
|
}
|
|
|
|
task aggregatedJavadoc(type: Javadoc) {
|
|
dependsOn dependencyVersions
|
|
project.rootProject.gradle.projectsEvaluated {
|
|
Set<Project> publishedProjects = rootProject.subprojects.findAll { it != project }
|
|
.findAll { it.plugins.hasPlugin(JavaPlugin) && it.plugins.hasPlugin(MavenPublishPlugin) }
|
|
.findAll { !it.path.contains(":spring-boot-tools:") ||
|
|
it.path.contains(":spring-boot-tools:spring-boot-buildpack-platform") ||
|
|
it.path.contains(":spring-boot-tools:spring-boot-loader-tools") }
|
|
.findAll { !it.name.startsWith('spring-boot-starter') }
|
|
dependsOn publishedProjects.javadoc
|
|
source publishedProjects.javadoc.source
|
|
classpath = project.files(publishedProjects.javadoc.classpath)
|
|
destinationDir = project.file "${buildDir}/docs/javadoc"
|
|
options {
|
|
author = true
|
|
docTitle = "Spring Boot ${project.version} API"
|
|
memberLevel = "protected"
|
|
outputLevel = "quiet"
|
|
splitIndex = true
|
|
use = true
|
|
windowTitle = "Spring Boot ${project.version} API"
|
|
}
|
|
doFirst {
|
|
def versionConstraints = dependencyVersions.versionConstraints
|
|
def tomcatVersion = "${versionConstraints["org.apache.tomcat:tomcat-annotations-api"]}"
|
|
def tomcatDocsVersion = tomcatVersion.substring(0, tomcatVersion.lastIndexOf("."));
|
|
options.links = [
|
|
"https://docs.oracle.com/en/java/javase/17/docs/api/",
|
|
"https://docs.spring.io/spring-framework/docs/${versionConstraints["org.springframework:spring-core"]}/javadoc-api/",
|
|
"https://docs.spring.io/spring-security/site/docs/${versionConstraints["org.springframework.security:spring-security-core"]}/api/",
|
|
"https://jakarta.ee/specifications/platform/9/apidocs/",
|
|
"https://tomcat.apache.org/tomcat-${tomcatDocsVersion}-doc/api/",
|
|
] as String[]
|
|
}
|
|
}
|
|
}
|
|
|
|
task documentTestSlices(type: org.springframework.boot.build.test.autoconfigure.DocumentTestSlices) {
|
|
testSlices = configurations.testSlices
|
|
outputFile = file("${buildDir}/generated/docs/test-auto-configuration/documented-slices.adoc")
|
|
}
|
|
|
|
task documentStarters(type: org.springframework.boot.build.starters.DocumentStarters) {
|
|
outputDir = file("${buildDir}/generated/docs/using/starters/")
|
|
}
|
|
|
|
task documentAutoConfigurationClasses(type: org.springframework.boot.build.autoconfigure.DocumentAutoConfigurationClasses) {
|
|
autoConfiguration = configurations.autoConfiguration
|
|
outputDir = file("${buildDir}/generated/docs/auto-configuration-classes/documented-auto-configuration-classes/")
|
|
}
|
|
|
|
task documentDependencyVersionCoordinates(type: org.springframework.boot.build.constraints.DocumentConstrainedVersions) {
|
|
dependsOn dependencyVersions
|
|
constrainedVersions.set(providers.provider { dependencyVersions.constrainedVersions })
|
|
outputFile = file("${buildDir}/generated/docs/dependency-versions/documented-coordinates.adoc")
|
|
}
|
|
|
|
task documentDependencyVersionProperties(type: org.springframework.boot.build.constraints.DocumentVersionProperties) {
|
|
dependsOn dependencyVersions
|
|
versionProperties.set(providers.provider { dependencyVersions.versionProperties})
|
|
outputFile = file("${buildDir}/generated/docs/dependency-versions/documented-properties.adoc")
|
|
}
|
|
|
|
task documentConfigurationProperties(type: org.springframework.boot.build.context.properties.DocumentConfigurationProperties) {
|
|
configurationPropertyMetadata = configurations.configurationProperties
|
|
outputDir = file("${buildDir}/generated/docs/application-properties")
|
|
}
|
|
|
|
task documentDevtoolsPropertyDefaults(type: org.springframework.boot.build.devtools.DocumentDevtoolsPropertyDefaults) {}
|
|
|
|
task runRemoteSpringApplicationExample(type: org.springframework.boot.build.docs.ApplicationRunner) {
|
|
classpath = configurations.remoteSpringApplicationExample
|
|
mainClass = "org.springframework.boot.devtools.RemoteSpringApplication"
|
|
args = ["https://myapp.example.com", "--spring.devtools.remote.secret=secret", "--spring.devtools.livereload.port=0"]
|
|
output = file("$buildDir/example-output/remote-spring-application.txt")
|
|
expectedLogging = "Started RemoteSpringApplication in "
|
|
applicationJar = "/Users/myuser/.m2/repository/org/springframework/boot/spring-boot-devtools/${project.version}/spring-boot-devtools-${project.version}.jar"
|
|
normalizeLiveReloadPort()
|
|
}
|
|
|
|
task runSpringApplicationExample(type: org.springframework.boot.build.docs.ApplicationRunner) {
|
|
classpath = configurations.springApplicationExample + sourceSets.main.output
|
|
mainClass = "org.springframework.boot.docs.features.logexample.MyApplication"
|
|
args = ["--server.port=0"]
|
|
output = file("$buildDir/example-output/spring-application.txt")
|
|
expectedLogging = "Started MyApplication in "
|
|
normalizeTomcatPort()
|
|
}
|
|
|
|
task runLoggingFormatExample(type: org.springframework.boot.build.docs.ApplicationRunner) {
|
|
classpath = configurations.springApplicationExample + sourceSets.main.output
|
|
mainClass = "org.springframework.boot.docs.features.logexample.MyApplication"
|
|
args = ["--spring.main.banner-mode=off", "--server.port=0", "--spring.application.name=myapp"]
|
|
output = file("$buildDir/example-output/logging-format.txt")
|
|
expectedLogging = "Started MyApplication in "
|
|
normalizeTomcatPort()
|
|
}
|
|
|
|
def getRelativeExamplesPath(var outputs) {
|
|
def fileName = outputs.files.singleFile.name
|
|
'example$example-output/' + fileName
|
|
}
|
|
|
|
def antoraRootAggregateContent = tasks.register("antoraRootAggregateContent", Zip) {
|
|
destinationDirectory = layout.buildDirectory.dir('generated/docs/antora-content')
|
|
archiveClassifier = "root-aggregate-content"
|
|
from("src/main") {
|
|
into "modules/ROOT/examples"
|
|
}
|
|
from(project.configurations.configurationProperties) {
|
|
eachFile {
|
|
it.path = rootProject
|
|
.projectDir
|
|
.toPath()
|
|
.relativize(it.file.toPath())
|
|
.toString()
|
|
.replace('\\', '/')
|
|
.replaceAll('.*/([^/]+)/build.*', 'modules/ROOT/partials/$1/spring-configuration-metadata.json')
|
|
}
|
|
}
|
|
from(runRemoteSpringApplicationExample) {
|
|
into "modules/ROOT/examples"
|
|
}
|
|
from(documentDevtoolsPropertyDefaults) {
|
|
into "modules/ROOT/partials/propertydefaults"
|
|
}
|
|
from(documentStarters) {
|
|
into "modules/ROOT/partials/starters"
|
|
}
|
|
from(documentTestSlices) {
|
|
into "modules/appendix/partials/slices"
|
|
}
|
|
from(runSpringApplicationExample) {
|
|
into "modules/ROOT/partials/application"
|
|
}
|
|
from(runLoggingFormatExample) {
|
|
into "modules/ROOT/partials/logging"
|
|
}
|
|
from(documentDependencyVersionCoordinates) {
|
|
into "modules/appendix/partials/dependency-versions"
|
|
}
|
|
from(documentDependencyVersionProperties) {
|
|
into "modules/appendix/partials/dependency-versions"
|
|
}
|
|
from(documentAutoConfigurationClasses) {
|
|
into "modules/appendix/partials/auto-configuration-classes"
|
|
}
|
|
from(documentConfigurationProperties) {
|
|
into "modules/appendix/partials/configuration-properties"
|
|
}
|
|
from(tasks.getByName("generateAntoraYml")) {
|
|
into "modules"
|
|
}
|
|
}
|
|
|
|
def antoraApiCatalogContent = tasks.register("antoraApiCatalogContent", Zip) {
|
|
destinationDirectory = layout.buildDirectory.dir('generated/docs/antora-content')
|
|
archiveClassifier = "api-catalog-content"
|
|
from(aggregatedJavadoc) {
|
|
into "java"
|
|
}
|
|
from(tasks.named("dokkatooGeneratePublicationHtml")) {
|
|
into "kotlin"
|
|
}
|
|
}
|
|
|
|
def copyAntoraContentDependencies = tasks.register("copyAntoraContentDependencies", Copy) {
|
|
into layout.buildDirectory.dir('generated/docs/antora-dependencies-content')
|
|
from(configurations.antoraContent)
|
|
rename("spring-boot-actuator-autoconfigure", "spring-boot-docs")
|
|
rename("spring-boot-maven-plugin", "spring-boot-docs")
|
|
rename("spring-boot-gradle-plugin", "spring-boot-docs")
|
|
}
|
|
|
|
tasks.named("antora") {
|
|
inputs.files(antoraRootAggregateContent, antoraApiCatalogContent, copyAntoraContentDependencies)
|
|
}
|
|
|
|
gradle.projectsEvaluated {
|
|
def mavenPublication = publishing.publications.getByName("maven");
|
|
configurations.antoraContent.dependencies.forEach { dependency ->
|
|
dependency.dependencyProject.configurations.getByName(dependency.targetConfiguration)
|
|
.artifacts.forEach(mavenPublication::artifact)
|
|
}
|
|
}
|
|
|
|
dokkatoo {
|
|
dokkatooPublications.configureEach {
|
|
includes.from("src/docs/dokkatoo/dokka-overview.md")
|
|
}
|
|
}
|
|
|
|
publishing {
|
|
publications {
|
|
getByName("maven") {
|
|
artifact antoraRootAggregateContent
|
|
artifact antoraApiCatalogContent
|
|
}
|
|
}
|
|
}
|