spring-boot/spring-boot-project/spring-boot-starters/spring-boot-starter-parent/build.gradle
2024-06-28 11:45:54 -05:00

350 lines
9.9 KiB
Groovy

plugins {
id "org.springframework.boot.conventions"
id "org.springframework.boot.deployed"
id "org.springframework.boot.maven-repository"
}
description = "Parent pom providing dependency and plugin management for applications built with Maven"
publishing.publications.withType(MavenPublication) {
pom.withXml { xml ->
def root = xml.asNode()
root.groupId.replaceNode {
parent {
delegate.groupId("${project.group}")
delegate.artifactId("spring-boot-dependencies")
delegate.version("${project.version}")
}
}
root.remove(root.version)
root.description.plus {
properties {
delegate."java.version"('17')
delegate."resource.delimiter"('@')
delegate."maven.compiler.release"('${java.version}')
delegate."project.build.sourceEncoding"('UTF-8')
delegate."project.reporting.outputEncoding"('UTF-8')
delegate."spring-boot.run.main-class"('${start-class}')
}
}
root.scm.plus {
build {
resources {
resource {
delegate.directory('${basedir}/src/main/resources')
delegate.filtering('true')
includes {
delegate.include('**/application*.yml')
delegate.include('**/application*.yaml')
delegate.include('**/application*.properties')
}
}
resource {
delegate.directory('${basedir}/src/main/resources')
excludes {
delegate.exclude('**/application*.yml')
delegate.exclude('**/application*.yaml')
delegate.exclude('**/application*.properties')
}
}
}
pluginManagement {
plugins {
plugin {
delegate.groupId('org.jetbrains.kotlin')
delegate.artifactId('kotlin-maven-plugin')
delegate.version('${kotlin.version}')
configuration {
delegate.jvmTarget('${java.version}')
delegate.javaParameters('true')
}
executions {
execution {
delegate.id('compile')
delegate.phase('compile')
goals {
delegate.goal('compile')
}
}
execution {
delegate.id('test-compile')
delegate.phase('test-compile')
goals {
delegate.goal('test-compile')
}
}
}
}
plugin {
delegate.groupId('org.apache.maven.plugins')
delegate.artifactId('maven-compiler-plugin')
configuration {
delegate.parameters('true')
}
}
plugin {
delegate.groupId('org.apache.maven.plugins')
delegate.artifactId('maven-failsafe-plugin')
executions {
execution {
goals {
delegate.goal('integration-test')
delegate.goal('verify')
}
}
}
configuration {
delegate.classesDirectory('${project.build.outputDirectory}')
}
}
plugin {
delegate.groupId('org.apache.maven.plugins')
delegate.artifactId('maven-jar-plugin')
configuration {
archive {
manifest {
delegate.mainClass('${start-class}')
delegate.addDefaultImplementationEntries('true')
}
}
}
}
plugin {
delegate.groupId('org.apache.maven.plugins')
delegate.artifactId('maven-war-plugin')
configuration {
archive {
manifest {
delegate.mainClass('${start-class}')
delegate.addDefaultImplementationEntries('true')
}
}
}
}
plugin {
delegate.groupId('org.apache.maven.plugins')
delegate.artifactId('maven-resources-plugin')
configuration {
delegate.propertiesEncoding('${project.build.sourceEncoding}')
delimiters {
delegate.delimiter('${resource.delimiter}')
}
delegate.useDefaultDelimiters('false')
}
}
plugin {
delegate.groupId('org.graalvm.buildtools')
delegate.artifactId('native-maven-plugin')
delegate.extensions('true')
}
plugin {
delegate.groupId('io.github.git-commit-id')
delegate.artifactId('git-commit-id-maven-plugin')
executions {
execution {
goals {
delegate.goal('revision')
}
}
}
configuration {
delegate.verbose('true')
delegate.generateGitPropertiesFile('true')
delegate.generateGitPropertiesFilename('${project.build.outputDirectory}/git.properties')
}
}
plugin {
delegate.groupId('org.cyclonedx')
delegate.artifactId('cyclonedx-maven-plugin')
executions {
execution {
delegate.phase('generate-resources')
goals {
delegate.goal('makeAggregateBom')
}
configuration {
delegate.projectType('application')
delegate.outputDirectory('${project.build.outputDirectory}/META-INF/sbom')
delegate.outputFormat('json')
delegate.outputName('application.cdx')
}
}
}
}
plugin {
delegate.groupId('org.springframework.boot')
delegate.artifactId('spring-boot-maven-plugin')
executions {
execution {
delegate.id('repackage')
goals {
delegate.goal('repackage')
}
}
}
configuration {
delegate.mainClass('${spring-boot.run.main-class}')
}
}
plugin {
delegate.groupId('org.apache.maven.plugins')
delegate.artifactId('maven-shade-plugin')
configuration {
delegate.keepDependenciesWithProvidedScope('true')
delegate.createDependencyReducedPom('true')
filters {
filter {
delegate.artifact('*:*')
excludes {
delegate.exclude('META-INF/*.SF')
delegate.exclude('META-INF/*.DSA')
delegate.exclude('META-INF/*.RSA')
}
}
}
}
delegate.dependencies {
dependency {
delegate.groupId('org.springframework.boot')
delegate.artifactId('spring-boot-maven-plugin')
delegate.version("${project.version}")
}
}
executions {
execution {
delegate.phase('package')
goals {
delegate.goal('shade')
}
configuration {
transformers {
transformer(implementation: 'org.apache.maven.plugins.shade.resource.AppendingTransformer') {
delegate.resource('META-INF/spring.handlers')
}
transformer(implementation: 'org.apache.maven.plugins.shade.resource.AppendingTransformer') {
delegate.resource('META-INF/spring.schemas')
}
transformer(implementation: 'org.apache.maven.plugins.shade.resource.AppendingTransformer') {
delegate.resource('META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports')
}
transformer(implementation: 'org.apache.maven.plugins.shade.resource.AppendingTransformer') {
delegate.resource('META-INF/spring/org.springframework.boot.actuate.autoconfigure.web.ManagementContextConfiguration.imports')
}
transformer(implementation: 'org.springframework.boot.maven.PropertiesMergingResourceTransformer') {
delegate.resource('META-INF/spring.factories')
}
transformer(implementation: 'org.apache.maven.plugins.shade.resource.ServicesResourceTransformer')
transformer(implementation: 'org.apache.maven.plugins.shade.resource.ManifestResourceTransformer') {
delegate.mainClass('${start-class}')
}
}
}
}
}
}
}
}
}
profiles {
profile {
delegate.id("native")
build {
pluginManagement {
plugins {
plugin {
delegate.groupId('org.apache.maven.plugins')
delegate.artifactId('maven-jar-plugin')
configuration {
archive {
manifestEntries {
delegate.'Spring-Boot-Native-Processed'("true")
}
}
}
}
plugin {
delegate.groupId('org.springframework.boot')
delegate.artifactId('spring-boot-maven-plugin')
configuration {
image {
env {
delegate.BP_NATIVE_IMAGE("true")
}
}
}
executions {
execution {
delegate.id('process-aot')
goals {
delegate.goal('process-aot')
}
}
}
}
plugin {
delegate.groupId('org.graalvm.buildtools')
delegate.artifactId('native-maven-plugin')
configuration {
delegate.classesDirectory('${project.build.outputDirectory}')
delegate.requiredVersion('22.3')
}
executions {
execution {
delegate.id('add-reachability-metadata')
goals {
delegate.goal('add-reachability-metadata')
}
}
}
}
}
}
}
}
profile {
delegate.id("nativeTest")
delegate.dependencies {
dependency {
delegate.groupId('org.junit.platform')
delegate.artifactId('junit-platform-launcher')
delegate.scope('test')
}
}
build {
plugins {
plugin {
delegate.groupId('org.springframework.boot')
delegate.artifactId('spring-boot-maven-plugin')
executions {
execution {
delegate.id('process-test-aot')
goals {
delegate.goal('process-test-aot')
}
}
}
}
plugin {
delegate.groupId('org.graalvm.buildtools')
delegate.artifactId('native-maven-plugin')
configuration {
delegate.classesDirectory('${project.build.outputDirectory}')
delegate.requiredVersion('22.3')
}
executions {
execution {
delegate.id('native-test')
goals {
delegate.goal('test')
}
}
}
}
}
}
}
}
}
}
}