Migrate maven-plugin to Antora

See gh-33766
This commit is contained in:
Phillip Webb
2024-03-19 21:47:48 -07:00
parent 18a2b2e9fb
commit 8ee20c8dae
73 changed files with 334 additions and 315 deletions

View File

@@ -0,0 +1,232 @@
integration-tests-no-starter-parent=integration-tests.no-starter-parent
integration-tests-example=integration-tests.examples
integration-tests-example-random-port=integration-tests.examples.random-port
integration-tests-example-jmx-port=integration-tests.examples.jmx-port
integration-tests-example-skip=integration-tests.examples.skip
build-image-docker-daemon=build-image.docker-daemon
build-image-docker-registry=build-image.docker-registry
build-image-customization=build-image.customization
build-image-examples=build-image.examples
build-image-example-custom-image-builder=build-image.examples.custom-image-builder
build-image-example-builder-configuration=build-image.examples.builder-configuration
build-image-example-runtime-jvm-configuration=build-image.examples.runtime-jvm-configuration
build-image-example-custom-image-name=build-image.examples.custom-image-name
build-image-example-buildpacks=build-image.examples.buildpacks
build-image-example-publish=build-image.examples.publish
build-image-example-docker=build-image.examples.docker
repackage=packaging
repackage-layers=packaging.layers
repackage-layers-configuration=packaging.layers.configuration=repackage-examples=packaging.examples
repackage-example-custom-classifier=packaging.examples.custom-classifier
repackage-example-custom-name=packaging.examples.custom-name
repackage-example-local-artifact=packaging.examples.local-artifact
repackage-example-custom-layout=packaging.examples.custom-layout
repackage-example-exclude-dependency=packaging.examples.exclude-dependency
repackage-layered-archive-tools=packaging.examples.layered-archive-tools
repackage-layered-archive-additional-layers=packaging.examples.custom-layers-configuration
run-examples=run.examples
run-example-debug=run.examples.debug
run-example-system-properties=run.examples.system-properties
run-example-environment-variables=run.examples.environment-variables
run-example-application-arguments=run.examples.using-application-arguments
run-example-active-profiles=run.examples.specify-active-profiles
using-parent-pom=using.parent-pom
using-import=using.import
using-overriding-command-line=using.overriding-command-line
_processing_applications=aot.processing-applications
_using_the_native_profile=aot.processing-applications.using-the-native-profile
_processing_tests=aot.processing-tests
# Consistent section IDs for goals
goals-build-image=build-image.build-image-goal
goals-build-image-no-fork=build-image.build-image-no-fork-goal
goals-build-image-no-fork-parameters-details=build-image.build-image-no-fork-goal.parameter-details
goals-build-image-no-fork-parameters-details-classifier=build-image.build-image-no-fork-goal.parameter-details.classifier
goals-build-image-no-fork-parameters-details-docker=build-image.build-image-no-fork-goal.parameter-details.docker
goals-build-image-no-fork-parameters-details-excludeDevtools=build-image.build-image-no-fork-goal.parameter-details.exclude-devtools
goals-build-image-no-fork-parameters-details-excludeDockerCompose=build-image.build-image-no-fork-goal.parameter-details.exclude-docker-compose
goals-build-image-no-fork-parameters-details-excludeGroupIds=build-image.build-image-no-fork-goal.parameter-details.exclude-group-ids
goals-build-image-no-fork-parameters-details-excludes=build-image.build-image-no-fork-goal.parameter-details.excludes
goals-build-image-no-fork-parameters-details-image=build-image.build-image-no-fork-goal.parameter-details.image
goals-build-image-no-fork-parameters-details-includeSystemScope=build-image.build-image-no-fork-goal.parameter-details.include-system-scope
goals-build-image-no-fork-parameters-details-includes=build-image.build-image-no-fork-goal.parameter-details.includes
goals-build-image-no-fork-parameters-details-layers=build-image.build-image-no-fork-goal.parameter-details.layers
goals-build-image-no-fork-parameters-details-layout=build-image.build-image-no-fork-goal.parameter-details.layout
goals-build-image-no-fork-parameters-details-layoutFactory=build-image.build-image-no-fork-goal.parameter-details.layout-factory
goals-build-image-no-fork-parameters-details-mainClass=build-image.build-image-no-fork-goal.parameter-details.main-class
goals-build-image-no-fork-parameters-details-skip=build-image.build-image-no-fork-goal.parameter-details.skip
goals-build-image-no-fork-parameters-details-sourceDirectory=build-image.build-image-no-fork-goal.parameter-details.source-directory
goals-build-image-no-fork-parameters-optional=build-image.build-image-no-fork-goal.optional-parameters
goals-build-image-no-fork-parameters-required=build-image.build-image-no-fork-goal.required-parameters
goals-build-image-parameters-details=build-image.build-image-goal.parameter-details
goals-build-image-parameters-details-classifier=build-image.build-image-goal.parameter-details.classifier
goals-build-image-parameters-details-docker=build-image.build-image-goal.parameter-details.docker
goals-build-image-parameters-details-excludeDevtools=build-image.build-image-goal.parameter-details.exclude-devtools
goals-build-image-parameters-details-excludeDockerCompose=build-image.build-image-goal.parameter-details.exclude-docker-compose
goals-build-image-parameters-details-excludeGroupIds=build-image.build-image-goal.parameter-details.exclude-group-ids
goals-build-image-parameters-details-excludes=build-image.build-image-goal.parameter-details.excludes
goals-build-image-parameters-details-image=build-image.build-image-goal.parameter-details.image
goals-build-image-parameters-details-includeSystemScope=build-image.build-image-goal.parameter-details.include-system-scope
goals-build-image-parameters-details-includes=build-image.build-image-goal.parameter-details.includes
goals-build-image-parameters-details-layers=build-image.build-image-goal.parameter-details.layers
goals-build-image-parameters-details-layout=build-image.build-image-goal.parameter-details.layout
goals-build-image-parameters-details-layoutFactory=build-image.build-image-goal.parameter-details.layout-factory
goals-build-image-parameters-details-mainClass=build-image.build-image-goal.parameter-details.main-class
goals-build-image-parameters-details-skip=build-image.build-image-goal.parameter-details.skip
goals-build-image-parameters-details-sourceDirectory=build-image.build-image-goal.parameter-details.source-directory
goals-build-image-parameters-optional=build-image.build-image-goal.optional-parameters
goals-build-image-parameters-required=build-image.build-image-goal.required-parameters
goals-build-info=build-info.build-info-goal
goals-build-info-parameters-details=build-info.build-info-goal.parameter-details
goals-build-info-parameters-details-additionalProperties=build-info.build-info-goal.parameter-details.additional-properties
goals-build-info-parameters-details-excludeInfoProperties=build-info.build-info-goal.parameter-details.exclude-info-properties
goals-build-info-parameters-details-outputFile=build-info.build-info-goal.parameter-details.output-file
goals-build-info-parameters-details-skip=build-info.build-info-goal.parameter-details.skip
goals-build-info-parameters-details-time=build-info.build-info-goal.parameter-details.time
goals-build-info-parameters-optional=build-info.build-info-goal.optional-parameters
goals-help=help.help-goal
goals-help-parameters-details=help.help-goal.parameter-details
goals-help-parameters-details-detail=help.help-goal.parameter-details.detail
goals-help-parameters-details-goal=help.help-goal.parameter-details.goal
goals-help-parameters-details-indentSize=help.help-goal.parameter-details.indent-size
goals-help-parameters-details-lineLength=help.help-goal.parameter-details.line-length
goals-help-parameters-optional=help.help-goal.optional-parameters
goals-process-aot=aot.process-aot-goal
goals-process-aot-parameters-details=aot.process-aot-goal.parameter-details
goals-process-aot-parameters-details-arguments=aot.process-aot-goal.parameter-details.arguments
goals-process-aot-parameters-details-classesDirectory=aot.process-aot-goal.parameter-details.classes-directory
goals-process-aot-parameters-details-compilerArguments=aot.process-aot-goal.parameter-details.compiler-arguments
goals-process-aot-parameters-details-excludeGroupIds=aot.process-aot-goal.parameter-details.exclude-group-ids
goals-process-aot-parameters-details-excludes=aot.process-aot-goal.parameter-details.excludes
goals-process-aot-parameters-details-generatedClasses=aot.process-aot-goal.parameter-details.generated-classes
goals-process-aot-parameters-details-generatedResources=aot.process-aot-goal.parameter-details.generated-resources
goals-process-aot-parameters-details-generatedSources=aot.process-aot-goal.parameter-details.generated-sources
goals-process-aot-parameters-details-includes=aot.process-aot-goal.parameter-details.includes
goals-process-aot-parameters-details-jvmArguments=aot.process-aot-goal.parameter-details.jvm-arguments
goals-process-aot-parameters-details-mainClass=aot.process-aot-goal.parameter-details.main-class
goals-process-aot-parameters-details-profiles=aot.process-aot-goal.parameter-details.profiles
goals-process-aot-parameters-details-skip=aot.process-aot-goal.parameter-details.skip
goals-process-aot-parameters-details-systemPropertyVariables=aot.process-aot-goal.parameter-details.system-property-variables
goals-process-aot-parameters-optional=aot.process-aot-goal.optional-parameters
goals-process-aot-parameters-required=aot.process-aot-goal.required-parameters
goals-process-test-aot=aot.process-test-aot-goal
goals-process-test-aot-parameters-details=aot.process-test-aot-goal.parameter-details
goals-process-test-aot-parameters-details-classesDirectory=aot.process-test-aot-goal.parameter-details.classes-directory
goals-process-test-aot-parameters-details-compilerArguments=aot.process-test-aot-goal.parameter-details.compiler-arguments
goals-process-test-aot-parameters-details-excludeGroupIds=aot.process-test-aot-goal.parameter-details.exclude-group-ids
goals-process-test-aot-parameters-details-excludes=aot.process-test-aot-goal.parameter-details.excludes
goals-process-test-aot-parameters-details-generatedClasses=aot.process-test-aot-goal.parameter-details.generated-classes
goals-process-test-aot-parameters-details-generatedResources=aot.process-test-aot-goal.parameter-details.generated-resources
goals-process-test-aot-parameters-details-generatedSources=aot.process-test-aot-goal.parameter-details.generated-sources
goals-process-test-aot-parameters-details-generatedTestClasses=aot.process-test-aot-goal.parameter-details.generated-test-classes
goals-process-test-aot-parameters-details-includes=aot.process-test-aot-goal.parameter-details.includes
goals-process-test-aot-parameters-details-jvmArguments=aot.process-test-aot-goal.parameter-details.jvm-arguments
goals-process-test-aot-parameters-details-skip=aot.process-test-aot-goal.parameter-details.skip
goals-process-test-aot-parameters-details-systemPropertyVariables=aot.process-test-aot-goal.parameter-details.system-property-variables
goals-process-test-aot-parameters-details-testClassesDirectory=aot.process-test-aot-goal.parameter-details.test-classes-directory
goals-process-test-aot-parameters-optional=aot.process-test-aot-goal.optional-parameters
goals-process-test-aot-parameters-required=aot.process-test-aot-goal.required-parameters
goals-repackage=packaging.repackage-goal
goals-repackage-parameters-details=packaging.repackage-goal.parameter-details
goals-repackage-parameters-details-attach=packaging.repackage-goal.parameter-details.attach
goals-repackage-parameters-details-classifier=packaging.repackage-goal.parameter-details.classifier
goals-repackage-parameters-details-embeddedLaunchScript=packaging.repackage-goal.parameter-details.embedded-launch-script
goals-repackage-parameters-details-embeddedLaunchScriptProperties=packaging.repackage-goal.parameter-details.embedded-launch-script-properties
goals-repackage-parameters-details-excludeDevtools=packaging.repackage-goal.parameter-details.exclude-devtools
goals-repackage-parameters-details-excludeDockerCompose=packaging.repackage-goal.parameter-details.exclude-docker-compose
goals-repackage-parameters-details-excludeGroupIds=packaging.repackage-goal.parameter-details.exclude-group-ids
goals-repackage-parameters-details-excludes=packaging.repackage-goal.parameter-details.excludes
goals-repackage-parameters-details-executable=packaging.repackage-goal.parameter-details.executable
goals-repackage-parameters-details-includeSystemScope=packaging.repackage-goal.parameter-details.include-system-scope
goals-repackage-parameters-details-includes=packaging.repackage-goal.parameter-details.includes
goals-repackage-parameters-details-layers=packaging.repackage-goal.parameter-details.layers
goals-repackage-parameters-details-layout=packaging.repackage-goal.parameter-details.layout
goals-repackage-parameters-details-layoutFactory=packaging.repackage-goal.parameter-details.layout-factory
goals-repackage-parameters-details-mainClass=packaging.repackage-goal.parameter-details.main-class
goals-repackage-parameters-details-outputDirectory=packaging.repackage-goal.parameter-details.output-directory
goals-repackage-parameters-details-outputTimestamp=packaging.repackage-goal.parameter-details.output-timestamp
goals-repackage-parameters-details-requiresUnpack=packaging.repackage-goal.parameter-details.requires-unpack
goals-repackage-parameters-details-skip=packaging.repackage-goal.parameter-details.skip
goals-repackage-parameters-optional=packaging.repackage-goal.optional-parameters
goals-repackage-parameters-required=packaging.repackage-goal.required-parameters
goals-run=run.run-goal
goals-run-parameters-details=run.run-goal.parameter-details
goals-run-parameters-details-addResources=run.run-goal.parameter-details.add-resources
goals-run-parameters-details-additionalClasspathElements=run.run-goal.parameter-details.additional-classpath-elements
goals-run-parameters-details-agents=run.run-goal.parameter-details.agents
goals-run-parameters-details-arguments=run.run-goal.parameter-details.arguments
goals-run-parameters-details-classesDirectory=run.run-goal.parameter-details.classes-directory
goals-run-parameters-details-commandlineArguments=run.run-goal.parameter-details.commandline-arguments
goals-run-parameters-details-directories=run.run-goal.parameter-details.directories
goals-run-parameters-details-environmentVariables=run.run-goal.parameter-details.environment-variables
goals-run-parameters-details-excludeGroupIds=run.run-goal.parameter-details.exclude-group-ids
goals-run-parameters-details-excludes=run.run-goal.parameter-details.excludes
goals-run-parameters-details-includes=run.run-goal.parameter-details.includes
goals-run-parameters-details-jvmArguments=run.run-goal.parameter-details.jvm-arguments
goals-run-parameters-details-mainClass=run.run-goal.parameter-details.main-class
goals-run-parameters-details-noverify=run.run-goal.parameter-details.noverify
goals-run-parameters-details-optimizedLaunch=run.run-goal.parameter-details.optimized-launch
goals-run-parameters-details-profiles=run.run-goal.parameter-details.profiles
goals-run-parameters-details-skip=run.run-goal.parameter-details.skip
goals-run-parameters-details-systemPropertyVariables=run.run-goal.parameter-details.system-property-variables
goals-run-parameters-details-useTestClasspath=run.run-goal.parameter-details.use-test-classpath
goals-run-parameters-details-workingDirectory=run.run-goal.parameter-details.working-directory
goals-run-parameters-optional=run.run-goal.optional-parameters
goals-run-parameters-required=run.run-goal.required-parameters
goals-start=integration-tests.start-goal
goals-start-parameters-details=integration-tests.start-goal.parameter-details
goals-start-parameters-details-addResources=integration-tests.start-goal.parameter-details.add-resources
goals-start-parameters-details-additionalClasspathElements=integration-tests.start-goal.parameter-details.additional-classpath-elements
goals-start-parameters-details-agents=integration-tests.start-goal.parameter-details.agents
goals-start-parameters-details-arguments=integration-tests.start-goal.parameter-details.arguments
goals-start-parameters-details-classesDirectory=integration-tests.start-goal.parameter-details.classes-directory
goals-start-parameters-details-commandlineArguments=integration-tests.start-goal.parameter-details.commandline-arguments
goals-start-parameters-details-directories=integration-tests.start-goal.parameter-details.directories
goals-start-parameters-details-environmentVariables=integration-tests.start-goal.parameter-details.environment-variables
goals-start-parameters-details-excludeGroupIds=integration-tests.start-goal.parameter-details.exclude-group-ids
goals-start-parameters-details-excludes=integration-tests.start-goal.parameter-details.excludes
goals-start-parameters-details-includes=integration-tests.start-goal.parameter-details.includes
goals-start-parameters-details-jmxName=integration-tests.start-goal.parameter-details.jmx-name
goals-start-parameters-details-jmxPort=integration-tests.start-goal.parameter-details.jmx-port
goals-start-parameters-details-jvmArguments=integration-tests.start-goal.parameter-details.jvm-arguments
goals-start-parameters-details-mainClass=integration-tests.start-goal.parameter-details.main-class
goals-start-parameters-details-maxAttempts=integration-tests.start-goal.parameter-details.max-attempts
goals-start-parameters-details-noverify=integration-tests.start-goal.parameter-details.noverify
goals-start-parameters-details-profiles=integration-tests.start-goal.parameter-details.profiles
goals-start-parameters-details-skip=integration-tests.start-goal.parameter-details.skip
goals-start-parameters-details-systemPropertyVariables=integration-tests.start-goal.parameter-details.system-property-variables
goals-start-parameters-details-useTestClasspath=integration-tests.start-goal.parameter-details.use-test-classpath
goals-start-parameters-details-wait=integration-tests.start-goal.parameter-details.wait
goals-start-parameters-details-workingDirectory=integration-tests.start-goal.parameter-details.working-directory
goals-start-parameters-optional=integration-tests.start-goal.optional-parameters
goals-start-parameters-required=integration-tests.start-goal.required-parameters
goals-stop=integration-tests.stop-goal
goals-stop-parameters-details=integration-tests.stop-goal.parameter-details
goals-stop-parameters-details-jmxName=integration-tests.stop-goal.parameter-details.jmx-name
goals-stop-parameters-details-jmxPort=integration-tests.stop-goal.parameter-details.jmx-port
goals-stop-parameters-details-skip=integration-tests.stop-goal.parameter-details.skip
goals-stop-parameters-optional=integration-tests.stop-goal.optional-parameters
goals-test-run=run.test-run-goal
goals-test-run-parameters-details=run.test-run-goal.parameter-details
goals-test-run-parameters-details-addResources=run.test-run-goal.parameter-details.add-resources
goals-test-run-parameters-details-additionalClasspathElements=run.test-run-goal.parameter-details.additional-classpath-elements
goals-test-run-parameters-details-agents=run.test-run-goal.parameter-details.agents
goals-test-run-parameters-details-arguments=run.test-run-goal.parameter-details.arguments
goals-test-run-parameters-details-classesDirectory=run.test-run-goal.parameter-details.classes-directory
goals-test-run-parameters-details-commandlineArguments=run.test-run-goal.parameter-details.commandline-arguments
goals-test-run-parameters-details-directories=run.test-run-goal.parameter-details.directories
goals-test-run-parameters-details-environmentVariables=run.test-run-goal.parameter-details.environment-variables
goals-test-run-parameters-details-excludeGroupIds=run.test-run-goal.parameter-details.exclude-group-ids
goals-test-run-parameters-details-excludes=run.test-run-goal.parameter-details.excludes
goals-test-run-parameters-details-includes=run.test-run-goal.parameter-details.includes
goals-test-run-parameters-details-jvmArguments=run.test-run-goal.parameter-details.jvm-arguments
goals-test-run-parameters-details-mainClass=run.test-run-goal.parameter-details.main-class
goals-test-run-parameters-details-noverify=run.test-run-goal.parameter-details.noverify
goals-test-run-parameters-details-optimizedLaunch=run.test-run-goal.parameter-details.optimized-launch
goals-test-run-parameters-details-profiles=run.test-run-goal.parameter-details.profiles
goals-test-run-parameters-details-skip=run.test-run-goal.parameter-details.skip
goals-test-run-parameters-details-systemPropertyVariables=run.test-run-goal.parameter-details.system-property-variables
goals-test-run-parameters-details-testClassesDirectory=run.test-run-goal.parameter-details.test-classes-directory
goals-test-run-parameters-details-workingDirectory=run.test-run-goal.parameter-details.working-directory
goals-test-run-parameters-optional=run.test-run-goal.optional-parameters
goals-test-run-parameters-required=run.test-run-goal.required-parameters

View File

@@ -0,0 +1,10 @@
name: spring-boot
ext:
zip_contents_collector:
include:
- name: maven-plugin
classifier: aggregate-content
- name: maven-plugin
classifier: catalog-content
module: maven-plugin
destination: content-catalog

View File

@@ -0,0 +1 @@
include::maven-plugin:partial$nav-maven-plugin.adoc[]

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>aot-native-profile-buildpacks</artifactId>
<profiles>
<!-- tag::profile[] -->
<profile>
<id>native</id>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>build-image</id>
<goals>
<goal>build-image-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
<!-- end::profile[] -->
</profiles>
</project>

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>aot-native-nbt</artifactId>
<profiles>
<!-- tag::profile[] -->
<profile>
<id>native</id>
<build>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
<executions>
<execution>
<id>build-image</id>
<goals>
<goal>compile-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</profile>
<!-- end::profile[] -->
</profiles>
</project>

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>aot-native</artifactId>
<build>
<plugins>
<!-- tag::aot-native[] -->
<plugin>
<groupId>org.graalvm.buildtools</groupId>
<artifactId>native-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
<!-- end::aot-native[] -->
</plugins>
</build>
</project>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>aot</artifactId>
<build>
<plugins>
<!-- tag::aot[] -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>process-test-aot</id>
<goals>
<goal>process-test-aot</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- end::aot[] -->
</plugins>
</build>
</project>

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>aot</artifactId>
<build>
<plugins>
<!-- tag::aot[] -->
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>process-aot</id>
<goals>
<goal>process-aot</goal>
</goals>
</execution>
</executions>
</plugin>
<!-- end::aot[] -->
</plugins>
</build>
</project>

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::build-info[] -->
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>build-info</artifactId>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build-info</goal>
</goals>
<configuration>
<additionalProperties>
<encoding.source>UTF-8</encoding.source>
<encoding.reporting>UTF-8</encoding.reporting>
<java.version>${java.version}</java.version>
</additionalProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
<!-- end::build-info[] -->

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>getting-started</artifactId>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build-info</goal>
</goals>
<configuration>
<additionalProperties>
<encoding.source>UTF-8</encoding.source>
<encoding.reporting>UTF-8</encoding.reporting>
<java.source>${maven.compiler.source}</java.source>
<java.target>${maven.compiler.target}</java.target>
</additionalProperties>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- tag::plugin-repositories[] -->
<pluginRepositories>
<pluginRepository>
<id>spring-snapshots</id>
<url>https://repo.spring.io/snapshot</url>
</pluginRepository>
<pluginRepository>
<id>spring-milestones</id>
<url>https://repo.spring.io/milestone</url>
</pluginRepository>
</pluginRepositories>
<!-- end::plugin-repositories[] -->
</project>

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::getting-started[] -->
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>getting-started</artifactId>
<!-- ... -->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
<!-- end::getting-started[] -->

View File

@@ -0,0 +1,33 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>integration-tests</artifactId>
<!-- tag::customize-jmx-port[] -->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<jmxPort>9009</jmxPort>
</configuration>
<executions>
<execution>
<id>pre-integration-test</id>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>post-integration-test</id>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- end::customize-jmx-port[] -->
</project>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>integration-tests</artifactId>
<build>
<plugins>
<!-- tag::failsafe[] -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<classesDirectory>${project.build.outputDirectory}</classesDirectory>
</configuration>
</plugin>
<!-- end::failsafe[] -->
</plugins>
</build>
</project>

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>integration-tests</artifactId>
<!-- tag::integration-tests[] -->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>pre-integration-test</id>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>post-integration-test</id>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- end::integration-tests[] -->
</project>

View File

@@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>integration-tests</artifactId>
<!-- tag::random-port[] -->
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>reserve-tomcat-port</id>
<goals>
<goal>reserve-network-port</goal>
</goals>
<phase>process-resources</phase>
<configuration>
<portNames>
<portName>tomcat.http.port</portName>
</portNames>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>pre-integration-test</id>
<goals>
<goal>start</goal>
</goals>
<configuration>
<arguments>
<argument>--server.port=${tomcat.http.port}</argument>
</arguments>
</configuration>
</execution>
<execution>
<id>post-integration-test</id>
<goals>
<goal>stop</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<test.server.port>${tomcat.http.port}</test.server.port>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
<!-- end::random-port[] -->
</project>

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::skip-integration-tests[] -->
<project>
<properties>
<skip.it>false</skip.it>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>pre-integration-test</id>
<goals>
<goal>start</goal>
</goals>
<configuration>
<skip>${skip.it}</skip>
</configuration>
</execution>
<execution>
<id>post-integration-test</id>
<goals>
<goal>stop</goal>
</goals>
<configuration>
<skip>${skip.it}</skip>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
<skip>${skip.it}</skip>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- end::skip-integration-tests[] -->

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::caches[] -->
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<buildWorkspace>
<bind>
<source>/tmp/cache-${project.artifactId}.work</source>
</bind>
</buildWorkspace>
<buildCache>
<bind>
<source>/tmp/cache-${project.artifactId}.build</source>
</bind>
</buildCache>
<launchCache>
<bind>
<source>/tmp/cache-${project.artifactId}.launch</source>
</bind>
</launchCache>
</image>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- end::caches[] -->

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::build-image-example-builder-configuration[] -->
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<env>
<BP_JVM_VERSION>17</BP_JVM_VERSION>
</env>
</image>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- end::build-image-example-builder-configuration[] -->

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::buildpacks[] -->
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<buildpacks>
<buildpack>file:///path/to/example-buildpack.tgz</buildpack>
<buildpack>urn:cnb:builder:paketo-buildpacks/java</buildpack>
</buildpacks>
</image>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- end::buildpacks[] -->

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::caches[] -->
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<buildCache>
<volume>
<name>cache-${project.artifactId}.build</name>
</volume>
</buildCache>
<launchCache>
<volume>
<name>cache-${project.artifactId}.launch</name>
</volume>
</launchCache>
</image>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- end::caches[] -->

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::custom-image-builder[] -->
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<builder>mine/java-cnb-builder</builder>
<runImage>mine/java-cnb-run</runImage>
</image>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- end::custom-image-builder[] -->

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::custom-image-name[] -->
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<name>example.com/library/${project.artifactId}</name>
</image>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- end::custom-image-name[] -->

View File

@@ -0,0 +1,18 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::docker-colima[] -->
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<docker>
<host>unix:///${user.home}/.colima/docker.sock</host>
</docker>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- end::docker-colima[] -->

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::docker-minikube[] -->
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<docker>
<host>tcp://192.168.99.100:2376</host>
<tlsVerify>true</tlsVerify>
<certPath>/home/user/.minikube/certs</certPath>
</docker>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- end::docker-minikube[] -->

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::docker-podman[] -->
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<docker>
<host>unix:///run/user/1000/podman/podman.sock</host>
<bindHostToBuilder>true</bindHostToBuilder>
</docker>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- end::docker-podman[] -->

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::docker[] -->
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<docker>
<publishRegistry>
<url>${docker.publishRegistry.url}</url>
<username>${docker.publishRegistry.username}</username>
<password>${docker.publishRegistry.password}</password>
</publishRegistry>
</docker>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- end::docker[] -->

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::docker[] -->
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<name>docker.example.com/library/${project.artifactId}</name>
<publish>true</publish>
</image>
<docker>
<publishRegistry>
<username>user</username>
<password>secret</password>
</publishRegistry>
</docker>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- end::docker[] -->

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::docker-registry-authentication[] -->
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<docker>
<builderRegistry>
<username>user</username>
<password>secret</password>
<url>https://docker.example.com/v1/</url>
<email>user@example.com</email>
</builderRegistry>
</docker>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- end::docker-registry-authentication[] -->

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::docker-token-authentication[] -->
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<docker>
<builderRegistry>
<token>9cbaf023786cd7...</token>
</builderRegistry>
</docker>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- end::docker-token-authentication[] -->

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::paketo[] -->
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<env>
<HTTP_PROXY>http://proxy.example.com</HTTP_PROXY>
<HTTPS_PROXY>https://proxy.example.com</HTTPS_PROXY>
</env>
</image>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- end::paketo[] -->

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>packaging-oci-image</artifactId>
<!-- ... -->
<!-- tag::packaging-oci-image[] -->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>build-image-no-fork</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- end::packaging-oci-image[] -->
</project>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::runtime-jvm-configuration[] -->
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<env>
<BPE_DELIM_JAVA_TOOL_OPTIONS xml:space="preserve"> </BPE_DELIM_JAVA_TOOL_OPTIONS>
<BPE_APPEND_JAVA_TOOL_OPTIONS>-XX:+HeapDumpOnOutOfMemoryError</BPE_APPEND_JAVA_TOOL_OPTIONS>
</env>
</image>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- end::runtime-jvm-configuration[] -->

View File

@@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::classified-artifact[] -->
<project>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>jar</goal>
</goals>
<phase>package</phase>
<configuration>
<classifier>task</classifier>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>repackage</id>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<classifier>task</classifier>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
<!-- end::classified-artifact[] -->

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::custom-layers[] -->
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<layers>
<enabled>true</enabled>
<configuration>${project.basedir}/src/layers.xml</configuration>
</layers>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- end::custom-layers[] -->

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::custom-layout[] -->
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>repackage</id>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<layoutFactory implementation="com.example.CustomLayoutFactory">
<customProperty>value</customProperty>
</layoutFactory>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>com.example</groupId>
<artifactId>custom-layout</artifactId>
<version>0.0.1.BUILD-SNAPSHOT</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
<!-- end::custom-layout[] -->

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::custom-name[] -->
<project>
<build>
<finalName>my-app</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>repackage</id>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
<!-- end::custom-name[] -->

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::different-classifier[] -->
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>repackage</id>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<classifier>exec</classifier>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
<!-- end::different-classifier[] -->

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::disable-layers[] -->
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<layers>
<enabled>false</enabled>
</layers>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- end::disable-layers[] -->

View File

@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::exclude-artifact-group[] -->
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludeGroupIds>com.example</excludeGroupIds>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- end::exclude-artifact-group[] -->

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::exclude-artifact[] -->
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>com.example</groupId>
<artifactId>module1</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- end::exclude-artifact[] -->

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::exclude-dependency[] -->
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<layers>
<includeLayerTools>false</includeLayerTools>
</layers>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- end::exclude-dependency[] -->

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::jar-plugin-first[] -->
<project>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<configuration>
<classifier>task</classifier>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>repackage</id>
<configuration>
<classifier>task</classifier>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
<!-- end::jar-plugin-first[] -->

View File

@@ -0,0 +1,29 @@
<!-- tag::layers-configuration[] -->
<layers xmlns="http://www.springframework.org/schema/boot/layers"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/boot/layers
{url-spring-boot-layers-xsd}">
<application>
<into layer="spring-boot-loader">
<include>org/springframework/boot/loader/**</include>
</into>
<into layer="application" />
</application>
<dependencies>
<into layer="snapshot-dependencies">
<include>*:*:*SNAPSHOT</include>
</into>
<into layer="company-dependencies">
<include>com.acme:*</include>
</into>
<into layer="dependencies"/>
</dependencies>
<layerOrder>
<layer>dependencies</layer>
<layer>spring-boot-loader</layer>
<layer>snapshot-dependencies</layer>
<layer>company-dependencies</layer>
<layer>application</layer>
</layerOrder>
</layers>
<!-- end::layers-configuration[] -->

View File

@@ -0,0 +1,28 @@
<!-- tag::layers[] -->
<layers xmlns="http://www.springframework.org/schema/boot/layers"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/boot/layers
{url-spring-boot-layers-xsd}">
<application>
<into layer="spring-boot-loader">
<include>org/springframework/boot/loader/**</include>
</into>
<into layer="application" />
</application>
<dependencies>
<into layer="application">
<includeModuleDependencies />
</into>
<into layer="snapshot-dependencies">
<include>*:*:*SNAPSHOT</include>
</into>
<into layer="dependencies" />
</dependencies>
<layerOrder>
<layer>dependencies</layer>
<layer>spring-boot-loader</layer>
<layer>snapshot-dependencies</layer>
<layer>application</layer>
</layerOrder>
</layers>
<!-- end::layers[] -->

View File

@@ -0,0 +1,25 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::local-repackaged-artifact[] -->
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>repackage</id>
<goals>
<goal>repackage</goal>
</goals>
<configuration>
<attach>false</attach>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
<!-- end::local-repackaged-artifact[] -->

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>packaging</artifactId>
<!-- ... -->
<!-- tag::non-default[] -->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>${start.class}</mainClass>
<layout>ZIP</layout>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- end::non-default[] -->
</project>

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::repackage-configuration[] -->
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<id>repackage</id>
<configuration>
<classifier>exec</classifier>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
<!-- end::repackage-configuration[] -->

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>packaging</artifactId>
<!-- ... -->
<!-- tag::repackage[] -->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<!-- end::repackage[] -->
</project>

View File

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::active-profiles[] -->
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<profiles>
<profile>local</profile>
<profile>dev</profile>
</profiles>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- end::active-profiles[] -->

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::application-arguments[] -->
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<arguments>
<argument>property1</argument>
<argument>property2=${my.value}</argument>
</arguments>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- end::application-arguments[] -->

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::debug[] -->
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<jvmArguments>
-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005
</jvmArguments>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- end::debug[] -->

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>running</artifactId>
<!-- ... -->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<!-- tag::devtools[] -->
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<!-- end::devtools[] -->
</project>

View File

@@ -0,0 +1,23 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::environment-variables[] -->
<project>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<environmentVariables>
<ENV1>5000</ENV1>
<ENV2>Some Text</ENV2>
<ENV3/>
<ENV4></ENV4>
</environmentVariables>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- end::environment-variables[] -->

View File

@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>getting-started</artifactId>
<!-- ... -->
<!-- tag::hot-refresh[] -->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<addResources>true</addResources>
</configuration>
</plugin>
</plugins>
</build>
<!-- end::hot-refresh[] -->
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
</project>

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::system-properties[] -->
<project>
<build>
<properties>
<my.value>42</my.value>
</properties>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<systemPropertyVariables>
<property1>test</property1>
<property2>${my.value}</property2>
</systemPropertyVariables>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- end::system-properties[] -->

View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- tag::default-and-override[] -->
<project>
<properties>
<app.profiles>local,dev</app.profiles>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<profiles>${app.profiles}</profiles>
</configuration>
</plugin>
</plugins>
</build>
</project>
<!-- end::default-and-override[] -->

View File

@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>getting-started</artifactId>
<!-- ... -->
<!-- tag::different-versions[] -->
<properties>
<slf4j.version>1.7.30</slf4j.version>
<spring-data-releasetrain.version>Moore-SR6</spring-data-releasetrain.version>
</properties>
<!-- end::different-versions[] -->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,43 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>getting-started</artifactId>
<!-- ... -->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<!-- tag::no-starter-parent-override-dependencies[] -->
<dependencyManagement>
<dependencies>
<!-- Override SLF4J provided by Spring Boot -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.30</version>
</dependency>
<!-- Override Spring Data release train provided by Spring Boot -->
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-releasetrain</artifactId>
<version>2020.0.0-SR1</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>{version-spring-boot}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<!-- end::no-starter-parent-override-dependencies[] -->
</project>

View File

@@ -0,0 +1,30 @@
<?xml version="1.0" encoding="UTF-8"?>
<project>
<modelVersion>4.0.0</modelVersion>
<artifactId>using</artifactId>
<!-- ... -->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<!-- tag::no-starter-parent[] -->
<dependencyManagement>
<dependencies>
<dependency>
<!-- Import dependency management from Spring Boot -->
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>{version-spring-boot}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<!-- end::no-starter-parent[] -->
</project>

View File

@@ -0,0 +1,100 @@
[[aot]]
= Ahead-of-Time Processing
Spring AOT is a process that analyzes your application at build-time and generate an optimized version of it.
It is a mandatory step to run a Spring `ApplicationContext` in a native image.
NOTE: For an overview of GraalVM Native Images support in Spring Boot, check the xref:reference:native-image/index.adoc[reference documentation].
The Spring Boot Maven plugin offers goals that can be used to perform AOT processing on both application and test code.
[[aot.processing-applications]]
== Processing Applications
To configure your application to use this feature, add an execution for the `process-aot` goal, as shown in the following example:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$aot/pom.xml[tags=aot]
----
As the `BeanFactory` is fully prepared at build-time, conditions are also evaluated.
This has an important difference compared to what a regular Spring Boot application does at runtime.
For instance, if you want to opt-in or opt-out for certain features, you need to configure the environment used at build time to do so.
The `process-aot` goal shares a number of properties with the xref:run.adoc[run goal] for that reason.
[[aot.processing-applications.using-the-native-profile]]
=== Using the Native Profile
If you use `spring-boot-starter-parent` as the `parent` of your project, a `native` profile can be used to streamline the steps required to build a native image.
The `native` profile configures the following:
* Execution of `process-aot` when the Spring Boot Maven Plugin is applied on a project.
* Suitable settings so that xref:build-image.adoc[build-image] generates a native image.
* Sensible defaults for the {url-native-build-tools-docs-maven-plugin}[Native Build Tools Maven Plugin], in particular:
** Making sure the plugin uses the raw classpath, and not the main jar file as it does not understand our repackaged jar format.
** Validate that a suitable GraalVM version is available.
** Download third-party reachability metadata.
To benefit from the `native` profile, a module that represents an application should define two plugins, as shown in the following example:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$aot-native/pom.xml[tags=aot-native]
----
A single project can trigger the generation of a native image on the command-line using either xref:reference:native-image/developing-your-first-application.adoc#native-image.developing-your-first-application.buildpacks.maven[Cloud Native Buildpacks] or xref:reference:native-image/developing-your-first-application.adoc#native-image.developing-your-first-application.native-build-tools.maven[Native Image Build Tools].
To use the `native` profile with a multi-modules project, you can create a customization of the `native` profile so that it invokes your preferred technique.
To bind Cloud Native Buildpacks during the `package` phase, add the following to the root POM of your multi-modules project:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$aot-native-profile-buildpacks/pom.xml[tags=profile]
----
The example below does the same for Native Build Tools:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$aot-native-profile-nbt/pom.xml[tags=profile]
----
Once the above is in place, you can build your multi-modules project and generate a native image in the relevant sub-modules, as shown in the following example:
[source,shell]
----
$ mvn package -Pnative
----
NOTE: A "relevant" sub-module is a module that represents a Spring Boot application.
Such module must define the Native Build Tools and Spring Boot plugins as described above.
include::partial$goals/process-aot.adoc[leveloffset=+1]
[[aot.processint-tests]]
== Processing Tests
The AOT engine can be applied to JUnit 5 tests that use Spring's Test Context Framework.
Suitable tests are processed by the AOT engine in order to generate `ApplicationContextInitializer` code.
To configure your application to use this feature, add an execution for the `process-test-aot` goal, as shown in the following example:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$aot-test/pom.xml[tags=aot]
----
TIP: If you are using `spring-boot-starter-parent`, this execution is automatically configured if you enable the `nativeTest` profile.
As with application AOT processing, the `BeanFactory` is fully prepared at build-time.
include::partial$goals/process-test-aot.adoc[leveloffset=+1]

View File

@@ -0,0 +1,540 @@
[[build-image]]
= Packaging OCI Images
The plugin can create an https://github.com/opencontainers/image-spec[OCI image] from a jar or war file using https://buildpacks.io/[Cloud Native Buildpacks] (CNB).
Images can be built on the command-line using the `build-image` goal.
This makes sure that the package lifecycle has run before the image is created.
NOTE: For security reasons, images build and run as non-root users.
See the {url-buildpacks-docs}/reference/spec/platform-api/#users[CNB specification] for more details.
The easiest way to get started is to invoke `mvn spring-boot:build-image` on a project.
It is possible to automate the creation of an image whenever the `package` phase is invoked, as shown in the following example:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging-oci-image/pom.xml[tags=packaging-oci-image]
----
NOTE: Use `build-image-no-fork` when binding the goal to the package lifecycle.
This goal is similar to `build-image` but does not fork the lifecycle to make sure `package` has run.
In the rest of this section, `build-image` is used to refer to either the `build-image` or `build-image-no-fork` goals.
TIP: While the buildpack runs from an xref:packaging.adoc[executable archive], it is not necessary to execute the `repackage` goal first as the executable archive is created automatically if necessary.
When the `build-image` repackages the application, it applies the same settings as the `repackage` goal would, that is dependencies can be excluded using one of the exclude options.
The `spring-boot-devtools` and `spring-boot-docker-compose` modules are automatically excluded by default (you can control this using the `excludeDevtools` and `excludeDockerCompose` properties).
[[build-image.docker-daemon]]
== Docker Daemon
The `build-image` goal requires access to a Docker daemon.
The goal will inspect local Docker CLI https://docs.docker.com/engine/reference/commandline/cli/#configuration-files[configuration files] to determine the current https://docs.docker.com/engine/context/working-with-contexts/[context] and use the context connection information to communicate with a Docker daemon.
If the current context can not be determined or the context does not have connection information, then the goal will use a default local connection.
This works with https://docs.docker.com/install/[Docker Engine] on all supported platforms without configuration.
Environment variables can be set to configure the `build-image` goal to use an alternative local or remote connection.
The following table shows the environment variables and their values:
|===
| Environment variable | Description
| DOCKER_CONFIG
| Location of Docker CLI https://docs.docker.com/engine/reference/commandline/cli/#configuration-files[configuration files] used to determine the current context (defaults to `$HOME/.docker`)
| DOCKER_CONTEXT
| Name of a https://docs.docker.com/engine/context/working-with-contexts/[context] that should be used to retrieve host information from Docker CLI configuration files (overrides `DOCKER_HOST`)
| DOCKER_HOST
| URL containing the host and port for the Docker daemon - for example `tcp://192.168.99.100:2376`
| DOCKER_TLS_VERIFY
| Enable secure HTTPS protocol when set to `1` (optional)
| DOCKER_CERT_PATH
| Path to certificate and key files for HTTPS (required if `DOCKER_TLS_VERIFY=1`, ignored otherwise)
|===
Docker daemon connection information can also be provided using `docker` parameters in the plugin configuration.
The following table summarizes the available parameters:
|===
| Parameter | Description
| `context`
| Name of a https://docs.docker.com/engine/context/working-with-contexts/[context] that should be used to retrieve host information from Docker CLI https://docs.docker.com/engine/reference/commandline/cli/#configuration-files[configuration files]
| `host`
| URL containing the host and port for the Docker daemon - for example `tcp://192.168.99.100:2376`
| `tlsVerify`
| Enable secure HTTPS protocol when set to `true` (optional)
| `certPath`
| Path to certificate and key files for HTTPS (required if `tlsVerify` is `true`, ignored otherwise)
| `bindHostToBuilder`
| When `true`, the value of the `host` property will be provided to the container that is created for the CNB builder (optional)
|===
For more details, see also xref:build-image.adoc#build-image.examples.docker[examples].
[[build-image.docker-registry]]
== Docker Registry
If the Docker images specified by the `builder` or `runImage` parameters are stored in a private Docker image registry that requires authentication, the authentication credentials can be provided using `docker.builderRegistry` parameters.
If the generated Docker image is to be published to a Docker image registry, the authentication credentials can be provided using `docker.publishRegistry` parameters.
Parameters are provided for user authentication or identity token authentication.
Consult the documentation for the Docker registry being used to store images for further information on supported authentication methods.
The following table summarizes the available parameters for `docker.builderRegistry` and `docker.publishRegistry`:
|===
| Parameter | Description
| `username`
| Username for the Docker image registry user. Required for user authentication.
| `password`
| Password for the Docker image registry user. Required for user authentication.
| `url`
| Address of the Docker image registry. Optional for user authentication.
| `email`
| E-mail address for the Docker image registry user. Optional for user authentication.
| `token`
| Identity token for the Docker image registry user. Required for token authentication.
|===
For more details, see also xref:build-image.adoc#build-image.examples.docker[examples].
[[build-image.customization]]
== Image Customizations
The plugin invokes a {url-buildpacks-docs}/concepts/components/builder/[builder] to orchestrate the generation of an image.
The builder includes multiple {url-buildpacks-docs}/concepts/components/buildpack[buildpacks] that can inspect the application to influence the generated image.
By default, the plugin chooses a builder image.
The name of the generated image is deduced from project properties.
The `image` parameter allows configuration of the builder and how it should operate on the project.
The following table summarizes the available parameters and their default values:
[cols="1,4,1"]
|===
| Parameter / (User Property)| Description | Default value
| `builder` +
(`spring-boot.build-image.builder`)
| Name of the Builder image to use.
| `paketobuildpacks/builder-jammy-base:latest`
| `runImage` +
(`spring-boot.build-image.runImage`)
| Name of the run image to use.
| No default value, indicating the run image specified in Builder metadata should be used.
| `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.
| `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.
Acceptable values are `ALWAYS`, `NEVER`, and `IF_NOT_PRESENT`.
| `ALWAYS`
| `env`
| Environment variables that should be passed to the builder.
|
| `buildpacks`
a|Buildpacks that the builder should use when building the image.
Only the specified buildpacks will be used, overriding the default buildpacks included in the builder.
Buildpack references must be in one of the following forms:
* Buildpack in the builder - `[urn:cnb:builder:]<buildpack ID>[@<version>]`
* Buildpack in a directory on the file system - `[file://]<path>`
* Buildpack in a gzipped tar (.tgz) file on the file system - `[file://]<path>/<file name>`
* Buildpack in an OCI image - `[docker://]<host>/<repo>[:<tag>][@<digest>]`
| None, indicating the builder should use the buildpacks included in it.
| `bindings`
a|https://docs.docker.com/storage/bind-mounts/[Volume bind mounts] that should be mounted to the builder container when building the image.
The bindings will be passed unparsed and unvalidated to Docker when creating the builder container.
Bindings must be in one of the following forms:
* `<host source path>:<container destination path>[:<options>]`
* `<host volume name>:<container destination path>[:<options>]`
Where `<options>` can contain:
* `ro` to mount the volume as read-only in the container
* `rw` to mount the volume as readable and writable in the container
* `volume-opt=key=value` to specify key-value pairs consisting of an option name and its value
|
| `network` + (`spring-boot.build-image.network`)
| The https://docs.docker.com/network/#network-drivers[network driver] the builder container will be configured to use.
The value supplied will be passed unvalidated to Docker when creating the builder container.
|
| `cleanCache` + (`spring-boot.build-image.cleanCache`)
| Whether to clean the cache before building.
| `false`
| `verboseLogging`
| Enables verbose logging of builder operations.
| `false`
| `publish` + (`spring-boot.build-image.publish`)
| Whether to publish the generated image to a Docker registry.
| `false`
| `tags`
| One or more additional tags to apply to the generated image.
The values provided to the `tags` option should be *full* image references.
See xref:build-image.adoc#build-image.customization.tags[the tags section] for more details.
|
| `buildWorkspace`
| A temporary workspace that will be used by the builder and buildpacks to store files during image building.
The value can be a named volume or a bind mount location.
| A named volume in the Docker daemon, with a name derived from the image name.
| `buildCache`
| A cache containing layers created by buildpacks and used by the image building process.
The value can be a named volume or a bind mount location.
| A named volume in the Docker daemon, with a name derived from the image name.
| `launchCache`
| A cache containing layers created by buildpacks and used by the image launching process.
The value can be a named volume or a bind mount location.
| A named volume in the Docker daemon, with a name derived from the image name.
| `createdDate` +
(`spring-boot.build-image.createdDate`)
| A date that will be used to set the `Created` field in the generated image's metadata.
The value must be a string in the ISO 8601 instant format, or `now` to use the current date and time.
| A fixed date that enables https://buildpacks.io/docs/features/reproducibility/[build reproducibility].
| `applicationDirectory` +
(`spring-boot.build-image.applicationDirectory`)
| The path to a directory that application contents will be uploaded to in the builder image.
Application contents will also be in this location in the generated image.
| `/workspace`
| `securityOptions`
| https://docs.docker.com/engine/reference/run/#security-configuration[Security options] that will be applied to the builder container, provided as an array of string values
| `["label=disable"]` on Linux and macOS, `[]` on Windows
|===
NOTE: The plugin detects the target Java compatibility of the project using the compiler's plugin configuration or the `maven.compiler.target` property.
When using the default Paketo builder and buildpacks, the plugin instructs the buildpacks to install the same Java version.
You can override this behaviour as shown in the xref:build-image.adoc#build-image.examples.builder-configuration[builder configuration] examples.
For more details, see also xref:build-image.adoc#build-image.examples[examples].
[[build-image.customization.tags]]
=== Tags format
The values provided to the `tags` option should be *full* image references.
The accepted format is `[domainHost:port/][path/]name[:tag][@digest]`.
If the domain is missing, it defaults to `docker.io`.
If the path is missing, it defaults to `library`.
If the tag is missing, it defaults to `latest`.
Some examples:
* `my-image` leads to the image reference `docker.io/library/my-image:latest`
* `my-repository/my-image` leads to `docker.io/my-repository/my-image:latest`
* `example.com/my-repository/my-image:1.0.0` will be used as is
include::partial$goals/build-image.adoc[leveloffset=+1]
include::partial$goals/build-image-no-fork.adoc[leveloffset=+1]
[[build-image.examples]]
== Examples
[[build-image.examples.custom-image-builder]]
=== Custom Image Builder
If you need to customize the builder used to create the image or the run image used to launch the built image, configure the plugin as shown in the following example:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging-oci-image/custom-image-builder-pom.xml[tags=custom-image-builder]
----
This configuration will use a builder image with the name `mine/java-cnb-builder` and the tag `latest`, and the run image named `mine/java-cnb-run` and the tag `latest`.
The builder and run image can be specified on the command line as well, as shown in this example:
[source,shell]
----
$ mvn spring-boot:build-image -Dspring-boot.build-image.builder=mine/java-cnb-builder -Dspring-boot.build-image.runImage=mine/java-cnb-run
----
[[build-image.examples.builder-configuration]]
=== Builder Configuration
If the builder exposes configuration options using environment variables, those can be set using the `env` attributes.
The following is an example of {url-paketo-docs-java-buildpack}/#configuring-the-jvm-version[configuring the JVM version] used by the Paketo Java buildpacks at build time:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging-oci-image/build-image-example-builder-configuration-pom.xml[tags=build-image-example-builder-configuration]
----
If there is a network proxy between the Docker daemon the builder runs in and network locations that buildpacks download artifacts from, you will need to configure the builder to use the proxy.
When using the Paketo builder, this can be accomplished by setting the `HTTPS_PROXY` and/or `HTTP_PROXY` environment variables as show in the following example:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging-oci-image/paketo-pom.xml[tags=paketo]
----
[[build-image.examples.runtime-jvm-configuration]]
=== Runtime JVM Configuration
Paketo Java buildpacks {url-paketo-docs-java-buildpack}/#runtime-jvm-configuration[configure the JVM runtime environment] by setting the `JAVA_TOOL_OPTIONS` environment variable.
The buildpack-provided `JAVA_TOOL_OPTIONS` value can be modified to customize JVM runtime behavior when the application image is launched in a container.
Environment variable modifications that should be stored in the image and applied to every deployment can be set as described in the {url-paketo-docs}/buildpacks/configuration/#environment-variables[Paketo documentation] and shown in the following example:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging-oci-image/runtime-jvm-configuration-pom.xml[tags=runtime-jvm-configuration]
----
[[build-image.examples.custom-image-name]]
=== Custom Image Name
By default, the image name is inferred from the `artifactId` and the `version` of the project, something like `docker.io/library/${project.artifactId}:${project.version}`.
You can take control over the name, as shown in the following example:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging-oci-image/custom-image-name-pom.xml[tags=custom-image-name]
----
NOTE: This configuration does not provide an explicit tag so `latest` is used.
It is possible to specify a tag as well, either using `${project.version}`, any property available in the build or a hardcoded version.
The image name can be specified on the command line as well, as shown in this example:
[source,shell]
----
$ mvn spring-boot:build-image -Dspring-boot.build-image.imageName=example.com/library/my-app:v1
----
[[build-image.examples.buildpacks]]
=== Buildpacks
By default, the builder will use buildpacks included in the builder image and apply them in a pre-defined order.
An alternative set of buildpacks can be provided to apply buildpacks that are not included in the builder, or to change the order of included buildpacks.
When one or more buildpacks are provided, only the specified buildpacks will be applied.
The following example instructs the builder to use a custom buildpack packaged in a `.tgz` file, followed by a buildpack included in the builder.
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging-oci-image/buildpacks-pom.xml[tags=buildpacks]
----
Buildpacks can be specified in any of the forms shown below.
A buildpack located in a CNB Builder (version may be omitted if there is only one buildpack in the builder matching the `buildpack-id`):
* `urn:cnb:builder:buildpack-id`
* `urn:cnb:builder:buildpack-id@0.0.1`
* `buildpack-id`
* `buildpack-id@0.0.1`
A path to a directory containing buildpack content (not supported on Windows):
* `\file:///path/to/buildpack/`
* `/path/to/buildpack/`
A path to a gzipped tar file containing buildpack content:
* `\file:///path/to/buildpack.tgz`
* `/path/to/buildpack.tgz`
An OCI image containing a https://buildpacks.io/docs/buildpack-author-guide/package-a-buildpack/[packaged buildpack]:
* `docker://example/buildpack`
* `docker:///example/buildpack:latest`
* `docker:///example/buildpack@sha256:45b23dee08...`
* `example/buildpack`
* `example/buildpack:latest`
* `example/buildpack@sha256:45b23dee08...`
[[build-image.examples.publish]]
=== Image Publishing
The generated image can be published to a Docker registry by enabling a `publish` option.
If the Docker registry requires authentication, the credentials can be configured using `docker.publishRegistry` parameters.
If the Docker registry does not require authentication, the `docker.publishRegistry` configuration can be omitted.
NOTE: The registry that the image will be published to is determined by the registry part of the image name (`docker.example.com` in these examples).
If `docker.publishRegistry` credentials are configured and include a `url` parameter, this value is passed to the registry but is not used to determine the publishing registry location.
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging-oci-image/docker-pom.xml[tags=docker]
----
The `publish` option can be specified on the command line as well, as shown in this example:
[source,shell]
----
$ mvn spring-boot:build-image -Dspring-boot.build-image.imageName=docker.example.com/library/my-app:v1 -Dspring-boot.build-image.publish=true
----
When using the `publish` option on the command line with authentication, you can provide credentials using properties as in this example:
[source,shell]
----
$ mvn spring-boot:build-image \
-Ddocker.publishRegistry.username=user \
-Ddocker.publishRegistry.password=secret \
-Ddocker.publishRegistry.url=docker.example.com \
-Dspring-boot.build-image.publish=true \
-Dspring-boot.build-image.imageName=docker.example.com/library/my-app:v1
----
and reference the properties in the XML configuration:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging-oci-image/docker-pom-authentication-command-line.xml[tags=docker]
----
[[build-image.examples.caches]]
=== Builder Cache and Workspace Configuration
The CNB builder caches layers that are used when building and launching an image.
By default, these caches are stored as named volumes in the Docker daemon with names that are derived from the full name of the target image.
If the image name changes frequently, for example when the project version is used as a tag in the image name, then the caches can be invalidated frequently.
The cache volumes can be configured to use alternative names to give more control over cache lifecycle as shown in the following example:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging-oci-image/caches-pom.xml[tags=caches]
----
Builders and buildpacks need a location to store temporary files during image building.
By default, this temporary build workspace is stored in a named volume.
The caches and the build workspace can be configured to use bind mounts instead of named volumes, as shown in the following example:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging-oci-image/bind-caches-pom.xml[tags=caches]
----
[[build-image.examples.docker]]
=== Docker Configuration
[[build-image.examples.docker.minikube]]
==== Docker Configuration for minikube
The plugin can communicate with the https://minikube.sigs.k8s.io/docs/tasks/docker_daemon/[Docker daemon provided by minikube] instead of the default local connection.
On Linux and macOS, environment variables can be set using the command `eval $(minikube docker-env)` after minikube has been started.
The plugin can also be configured to use the minikube daemon by providing connection details similar to those shown in the following example:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging-oci-image/docker-minikube-pom.xml[tags=docker-minikube]
----
[[build-image.examples.docker.podman]]
==== Docker Configuration for podman
The plugin can communicate with a https://podman.io/[podman container engine].
The plugin can be configured to use podman local connection by providing connection details similar to those shown in the following example:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging-oci-image/docker-podman-pom.xml[tags=docker-podman]
----
TIP: With the `colima` CLI installed, the command `podman info --format='{{.Host.RemoteSocket.Path}}'` can be used to get the value for the `docker.host` configuration property shown in this example.
[[build-image.examples.docker.colima]]
==== Docker Configuration for Colima
The plugin can communicate with the Docker daemon provided by https://github.com/abiosoft/colima[Colima].
The `DOCKER_HOST` environment variable can be set by using the command `export DOCKER_HOST=$(docker context inspect colima -f '{{.Endpoints.docker.Host}}').`
The plugin can also be configured to use Colima daemon by providing connection details similar to those shown in the following example:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging-oci-image/docker-colima-pom.xml[tags=docker-colima]
----
[[build-image.examples.docker.auth]]
==== Docker Configuration for Authentication
If the builder or run image are stored in a private Docker registry that supports user authentication, authentication details can be provided using `docker.builderRegistry` parameters as shown in the following example:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging-oci-image/docker-registry-authentication-pom.xml[tags=docker-registry-authentication]
----
If the builder or run image is stored in a private Docker registry that supports token authentication, the token value can be provided using `docker.builderRegistry` parameters as shown in the following example:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging-oci-image/docker-token-authentication-pom.xml[tags=docker-token-authentication]
----

View File

@@ -0,0 +1,18 @@
[[build-info]]
= Integrating with Actuator
Spring Boot Actuator displays build-related information if a `META-INF/build-info.properties` file is present.
The `build-info` goal generates such file with the coordinates of the project and the build time.
It also allows you to add an arbitrary number of additional properties, as shown in the following example:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$build-info/pom.xml[tags=build-info]
----
This configuration will generate a `build-info.properties` at the expected location with three additional keys.
NOTE: `java.version` is expected to be a regular property available in the project.
It will be interpolated as you would expect.
include::partial$goals/build-info.adoc[leveloffset=+1]

View File

@@ -0,0 +1,16 @@
[[getting-started]]
= Getting Started
To use the Spring Boot Maven Plugin, include the appropriate XML in the `plugins` section of your `pom.xml`, as shown in the following example:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$getting-started/pom.xml[tags=getting-started]
----
If you use a milestone or snapshot release, you also need to add the appropriate `pluginRepository` elements, as shown in the following listing:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$getting-started/plugin-repositories-pom.xml[tags=plugin-repositories]
----

View File

@@ -0,0 +1,6 @@
[[goals]]
= Goals
The Spring Boot Plugin has the following goals:
include::partial$goals/overview.adoc[]

View File

@@ -0,0 +1,5 @@
[[help]]
= Help Information
The `help` goal is a standard goal that displays information on the capabilities of the plugin.
include::partial$goals/help.adoc[leveloffset=+1]

View File

@@ -0,0 +1,9 @@
[[maven-plugin]]
= Maven Plugin
The Spring Boot Maven Plugin provides Spring Boot support in https://maven.org[Apache Maven].
It allows you to package executable jar or war archives, run Spring Boot applications, generate build information and start your Spring Boot application prior to running integration tests.
To use it, you must use Maven 3.6.3 or later.
In addition to this user guide, xref:api/java/index.html[API documentation] is also available.

View File

@@ -0,0 +1,95 @@
[[integration-tests]]
= Running Integration Tests
While you may start your Spring Boot application very easily from your test (or test suite) itself, it may be desirable to handle that in the build itself.
To make sure that the lifecycle of your Spring Boot application is properly managed around your integration tests, you can use the `start` and `stop` goals, as shown in the following example:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$integration-tests/pom.xml[tags=integration-tests]
----
Such setup can now use the https://maven.apache.org/surefire/maven-failsafe-plugin[failsafe-plugin] to run your integration tests as you would expect.
NOTE: The application is started in a separate process and JMX is used to communicate with the application.
By default, the plugin uses port `9001`.
If you need to configure the JMX port, see xref:integration-tests.adoc#integration-tests.examples.jmx-port[the dedicated example].
You could also configure a more advanced setup to skip the integration tests when a specific property has been set, see xref:integration-tests.adoc#integration-tests.examples.skip[the dedicated example].
[[integration-tests.no-starter-parent]]
== Using Failsafe Without Spring Boot's Parent POM
Spring Boot's Parent POM, `spring-boot-starter-parent`, configures Failsafe's `<classesDirectory>` to be `${project.build.outputDirectory}`.
Without this configuration, which causes Failsafe to use the compiled classes rather than the repackaged jar, Failsafe cannot load your application's classes.
If you are not using the parent POM, you should configure Failsafe in the same way, as shown in the following example:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$integration-tests/failsafe-pom.xml[tags=failsafe]
----
include::partial$goals/start.adoc[leveloffset=+1]
include::partial$goals/stop.adoc[leveloffset=+1]
[[integration-tests.examples]]
== Examples
[[integration-tests.examples.random-port]]
=== Random Port for Integration Tests
One nice feature of the Spring Boot test integration is that it can allocate a free port for the web application.
When the `start` goal of the plugin is used, the Spring Boot application is started separately, making it difficult to pass the actual port to the integration test itself.
The example below showcases how you could achieve the same feature using the https://www.mojohaus.org/build-helper-maven-plugin[Build Helper Maven Plugin]:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$integration-tests/random-port-pom.xml[tags=random-port]
----
You can now retrieve the `test.server.port` system property in any of your integration test to create a proper `URL` to the server.
[[integration-tests.examples.jmx-port]]
=== Customize JMX port
The `jmxPort` property allows to customize the port the plugin uses to communicate with the Spring Boot application.
This example shows how you can customize the port in case `9001` is already used:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$integration-tests/customize-jmx-port-pom.xml[tags=customize-jmx-port]
----
TIP: If you need to configure the JMX port, make sure to do so in the global configuration as shown above so that it is shared by both goals.
[[integration-tests.examples.skip]]
=== Skip Integration Tests
The `skip` property allows to skip the execution of the Spring Boot maven plugin altogether.
This example shows how you can skip integration tests with a command-line property and still make sure that the `repackage` goal runs:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$integration-tests/skip-integration-tests-pom.xml[tags=skip-integration-tests]
----
By default, the integration tests will run but this setup allows you to easily disable them on the command-line as follows:
[source,shell]
----
$ mvn verify -Dskip.it=true
----

View File

@@ -0,0 +1,282 @@
[[packaging]]
= Packaging Executable Archives
The plugin can create executable archives (jar files and war files) that contain all of an application's dependencies and can then be run with `java -jar`.
Packaging an executable archive is performed by the `repackage` goal, as shown in the following example:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging/repackage-pom.xml[tags=repackage]
----
TIP: If you are using `spring-boot-starter-parent`, such execution is already pre-configured with a `repackage` execution ID so that only the plugin definition should be added.
The example above repackages a `jar` or `war` archive that is built during the package phase of the Maven lifecycle, including any `provided` dependencies that are defined in the project.
If some of these dependencies need to be excluded, you can use one of the `exclude` options; see the xref:packaging.adoc#packaging.examples.exclude-dependency[dependency exclusion] for more details.
The original (that is non-executable) artifact is renamed to `.original` by default but it is also possible to keep the original artifact using a custom classifier.
NOTE: The `outputFileNameMapping` feature of the `maven-war-plugin` is currently not supported.
The `spring-boot-devtools` and `spring-boot-docker-compose` modules are automatically excluded by default (you can control this using the `excludeDevtools` and `excludeDockerCompose` properties).
In order to make that work with `war` packaging, the `spring-boot-devtools` and `spring-boot-docker-compose` dependencies must be set as `optional` or with the `provided` scope.
The plugin rewrites your manifest, and in particular it manages the `Main-Class` and `Start-Class` entries.
If the defaults don't work you have to configure the values in the Spring Boot plugin, not in the jar plugin.
The `Main-Class` in the manifest is controlled by the `layout` property of the Spring Boot plugin, as shown in the following example:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging/non-default-pom.xml[tags=non-default]
----
The `layout` property defaults to a value determined by the archive type (`jar` or `war`). The following layouts are available:
* `JAR`: regular executable JAR layout.
* `WAR`: executable WAR layout. `provided` dependencies are placed in `WEB-INF/lib-provided` to avoid any clash when the `war` is deployed in a servlet container.
* `ZIP` (alias to `DIR`): similar to the `JAR` layout using `PropertiesLauncher`.
* `NONE`: Bundle all dependencies and project resources. Does not bundle a bootstrap loader.
[[packaging.layers]]
== Layered Jar or War
A repackaged jar contains the application's classes and dependencies in `BOOT-INF/classes` and `BOOT-INF/lib` respectively.
Similarly, an executable war contains the application's classes in `WEB-INF/classes` and dependencies in `WEB-INF/lib` and `WEB-INF/lib-provided`.
For cases where a docker image needs to be built from the contents of a jar or war, it's useful to be able to separate these directories further so that they can be written into distinct layers.
Layered archives use the same layout as a regular repackaged jar or war, but include an additional meta-data file that describes each layer.
By default, the following layers are defined:
* `dependencies` for any dependency whose version does not contain `SNAPSHOT`.
* `spring-boot-loader` for the loader classes.
* `snapshot-dependencies` for any dependency whose version contains `SNAPSHOT`.
* `application` for local module dependencies, application classes, and resources.
Module dependencies are identified by looking at all of the modules that are part of the current build.
If a module dependency can only be resolved because it has been installed into Maven's local cache and it is not part of the current build, it will be identified as regular dependency.
The layers order is important as it determines how likely previous layers can be cached when part of the application changes.
The default order is `dependencies`, `spring-boot-loader`, `snapshot-dependencies`, `application`.
Content that is least likely to change should be added first, followed by layers that are more likely to change.
The repackaged archive includes the `layers.idx` file by default.
To disable this feature, you can do so in the following manner:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging/disable-layers-pom.xml[tags=disable-layers]
----
[[packaging.layers.configuration]]
=== Custom Layers Configuration
Depending on your application, you may want to tune how layers are created and add new ones.
This can be done using a separate configuration file that should be registered as shown below:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging/custom-layers-pom.xml[tags=custom-layers]
----
The configuration file describes how an archive can be separated into layers, and the order of those layers.
The following example shows how the default ordering described above can be defined explicitly:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging/layers.xml[tags=layers]
----
The `layers` XML format is defined in three sections:
* The `<application>` block defines how the application classes and resources should be layered.
* The `<dependencies>` block defines how dependencies should be layered.
* The `<layerOrder>` block defines the order that the layers should be written.
Nested `<into>` blocks are used within `<application>` and `<dependencies>` sections to claim content for a layer.
The blocks are evaluated in the order that they are defined, from top to bottom.
Any content not claimed by an earlier block remains available for subsequent blocks to consider.
The `<into>` block claims content using nested `<include>` and `<exclude>` elements.
The `<application>` section uses Ant-style path matching for include/exclude expressions.
The `<dependencies>` section uses `group:artifact[:version]` patterns.
It also provides `<includeModuleDependencies />` and `<excludeModuleDependencies />` elements that can be used to include or exclude local module dependencies.
If no `<include>` is defined, then all content (not claimed by an earlier block) is considered.
If no `<exclude>` is defined, then no exclusions are applied.
Looking at the `<dependencies>` example above, we can see that the first `<into>` will claim all module dependencies for the `application.layer`.
The next `<into>` will claim all SNAPSHOT dependencies for the `snapshot-dependencies` layer.
The final `<into>` will claim anything left (in this case, any dependency that is not a SNAPSHOT) for the `dependencies` layer.
The `<application>` block has similar rules.
First claiming `org/springframework/boot/loader/**` content for the `spring-boot-loader` layer.
Then claiming any remaining classes and resources for the `application` layer.
NOTE: The order that `<into>` blocks are defined is often different from the order that the layers are written.
For this reason the `<layerOrder>` element must always be included and _must_ cover all layers referenced by the `<into>` blocks.
include::partial$goals/repackage.adoc[leveloffset=+1]
[[packaging.examples]]
== Examples
[[packaging.examples.custom-classifier]]
=== Custom Classifier
By default, the `repackage` goal replaces the original artifact with the repackaged one.
That is a sane behavior for modules that represent an application but if your module is used as a dependency of another module, you need to provide a classifier for the repackaged one.
The reason for that is that application classes are packaged in `BOOT-INF/classes` so that the dependent module cannot load a repackaged jar's classes.
If that is the case or if you prefer to keep the original artifact and attach the repackaged one with a different classifier, configure the plugin as shown in the following example:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging/different-classifier-pom.xml[tags=different-classifier]
----
If you are using `spring-boot-starter-parent`, the `repackage` goal is executed automatically in an execution with id `repackage`.
In that setup, only the configuration should be specified, as shown in the following example:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging/repackage-configuration-pom.xml[tags=repackage-configuration]
----
This configuration will generate two artifacts: the original one and the repackaged counter part produced by the repackage goal.
Both will be installed/deployed transparently.
You can also use the same configuration if you want to repackage a secondary artifact the same way the main artifact is replaced.
The following configuration installs/deploys a single `task` classified artifact with the repackaged application:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging/classified-artifact-pom.xml[tags=classified-artifact]
----
As both the `maven-jar-plugin` and the `spring-boot-maven-plugin` runs at the same phase, it is important that the jar plugin is defined first (so that it runs before the repackage goal).
Again, if you are using `spring-boot-starter-parent`, this can be simplified as follows:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging/jar-plugin-first-pom.xml[tags=jar-plugin-first]
----
[[packaging.examples.custom-name]]
=== Custom Name
If you need the repackaged jar to have a different local name than the one defined by the `artifactId` attribute of the project, use the standard `finalName`, as shown in the following example:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging/custom-name-pom.xml[tags=custom-name]
----
This configuration will generate the repackaged artifact in `target/my-app.jar`.
[[packaging.examples.local-artifact]]
=== Local Repackaged Artifact
By default, the `repackage` goal replaces the original artifact with the executable one.
If you need to only deploy the original jar and yet be able to run your app with the regular file name, configure the plugin as follows:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging/local-repackaged-artifact-pom.xml[tags=local-repackaged-artifact]
----
This configuration generates two artifacts: the original one and the executable counter part produced by the `repackage` goal.
Only the original one will be installed/deployed.
[[packaging.examples.custom-layout]]
=== Custom Layout
Spring Boot repackages the jar file for this project using a custom layout factory defined in the additional jar file, provided as a dependency to the build plugin:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging/custom-layout-pom.xml[tags=custom-layout]
----
The layout factory is provided as an implementation of `LayoutFactory` (from `spring-boot-loader-tools`) explicitly specified in the pom.
If there is only one custom `LayoutFactory` on the plugin classpath and it is listed in `META-INF/spring.factories` then it is unnecessary to explicitly set it in the plugin configuration.
Layout factories are always ignored if an explicit <<packaging.repackage-goal.parameter-details.layout-factory,layout>> is set.
[[packaging.examples.exclude-dependency]]
=== Dependency Exclusion
By default, both the `repackage` and the `run` goals will include any `provided` dependencies that are defined in the project.
A Spring Boot project should consider `provided` dependencies as "container" dependencies that are required to run the application.
Generally speaking, Spring Boot projects are not used as dependencies and are therefore unlikely to have any `optional` dependencies.
When a project does have optional dependencies they too will be included by the `repackage` and `run` goals.
Some of these dependencies may not be required at all and should be excluded from the executable jar.
For consistency, they should not be present either when running the application.
There are two ways one can exclude a dependency from being packaged/used at runtime:
* Exclude a specific artifact identified by `groupId` and `artifactId`, optionally with a `classifier` if needed.
* Exclude any artifact belonging to a given `groupId`.
The following example excludes `com.example:module1`, and only that artifact:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging/exclude-artifact-pom.xml[tags=exclude-artifact]
----
This example excludes any artifact belonging to the `com.example` group:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging/exclude-artifact-group-pom.xml[tags=exclude-artifact-group]
----
[[packaging.examples.layered-archive-tools]]
=== Layered Archive Tools
When a layered jar or war is created, the `spring-boot-jarmode-layertools` jar will be added as a dependency to your archive.
With this jar on the classpath, you can launch your application in a special mode which allows the bootstrap code to run something entirely different from your application, for example, something that extracts the layers.
If you wish to exclude this dependency, you can do so in the following manner:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging/exclude-dependency-pom.xml[tags=exclude-dependency]
----
[[packaging.examples.custom-layers-configuration]]
=== Custom Layers Configuration
The default setup splits dependencies into snapshot and non-snapshot, however, you may have more complex rules.
For example, you may want to isolate company-specific dependencies of your project in a dedicated layer.
The following `layers.xml` configuration shown one such setup:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$packaging/layers-configuration.xml[tags=layers-configuration]
----
The configuration above creates an additional `company-dependencies` layer with all libraries with the `com.acme` groupId.

View File

@@ -0,0 +1,180 @@
[[run]]
= Running your Application with Maven
The plugin includes a run goal which can be used to launch your application from the command line, as shown in the following example:
[source,shell]
----
$ mvn spring-boot:run
----
Application arguments can be specified using the `arguments` parameter, see xref:run#run.examples.using-application-arguments[using application arguments] for more details.
The application is executed in a forked process and setting properties on the command-line will not affect the application.
If you need to specify some JVM arguments (that is for debugging purposes), you can use the `jvmArguments` parameter, see xref:run#run.examples.debug[Debug the application] for more details.
There is also explicit support for xref:run#run.examples.system-properties[system properties] and xref:run#run.examples.environment-variables[environment variables].
As enabling a profile is quite common, there is dedicated `profiles` property that offers a shortcut for `-Dspring-boot.run.jvmArguments="-Dspring.profiles.active=dev"`, see xref:run#run.examples.specify-active-profiles[Specify active profiles].
Spring Boot `devtools` is a module to improve the development-time experience when working on Spring Boot applications.
To enable it, just add the following dependency to your project:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$running/devtools-pom.xml[tags=devtools]
----
When `devtools` is running, it detects change when you recompile your application and automatically refreshes it.
This works for not only resources but code as well.
It also provides a LiveReload server so that it can automatically trigger a browser refresh whenever things change.
Devtools can also be configured to only refresh the browser whenever a static resource has changed (and ignore any change in the code).
Just include the following property in your project:
[source,properties]
----
spring.devtools.remote.restart.enabled=false
----
Prior to `devtools`, the plugin supported hot refreshing of resources by default which has now be disabled in favour of the solution described above.
You can restore it at any time by configuring your project:
[source,xml,subs="verbatim,attributes"]
----
include::example$running/hot-refresh-pom.xml[tags=hot-refresh]
----
When `addResources` is enabled, any `src/main/resources` directory will be added to the application classpath when you run the application and any duplicate found in the classes output will be removed.
This allows hot refreshing of resources which can be very useful when developing web applications.
For example, you can work on HTML, CSS or JavaScript files and see your changes immediately without recompiling your application.
It is also a helpful way of allowing your front end developers to work without needing to download and install a Java IDE.
NOTE: A side effect of using this feature is that filtering of resources at build time will not work.
In order to be consistent with the `repackage` goal, the `run` goal builds the classpath in such a way that any dependency that is excluded in the plugin's configuration gets excluded from the classpath as well.
For more details, see xref:packaging.adoc#packaging.examples.exclude-dependency[the dedicated example].
Sometimes it is useful to run a test variant of your application.
For example, if you want to xref:reference:features/testcontainers.adoc#features.testcontainers.at-development-time[use Testcontainers at development time] or make use of some test stubs.
Use the `test-run` goal with many of the same features and configuration options as `run` for this purpose.
include::partial$goals/run.adoc[leveloffset=+1]
include::partial$goals/test-run.adoc[leveloffset=+1]
[[run.examples]]
== Examples
[[run.examples.debug]]
=== Debug the Application
The `run` and `test-run` goals run your application in a forked process.
If you need to debug it, you should add the necessary JVM arguments to enable remote debugging.
The following configuration suspend the process until a debugger has joined on port 5005:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$running/debug-pom.xml[tags=debug]
----
These arguments can be specified on the command line as well:
[source,shell]
----
$ mvn spring-boot:run -Dspring-boot.run.jvmArguments=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=*:5005
----
[[run.examples.system-properties]]
=== Using System Properties
System properties can be specified using the `systemPropertyVariables` attribute.
The following example sets `property1` to `test` and `property2` to 42:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$running/system-properties-pom.xml[tags=system-properties]
----
If the value is empty or not defined (that is `<my-property/`>), the system property is set with an empty String as the value.
Maven trims values specified in the pom, so it is not possible to specify a System property which needs to start or end with a space through this mechanism: consider using `jvmArguments` instead.
Any String typed Maven variable can be passed as system properties.
Any attempt to pass any other Maven variable type (for example a `List` or a `URL` variable) will cause the variable expression to be passed literally (unevaluated).
The `jvmArguments` parameter takes precedence over system properties defined with the mechanism above.
In the following example, the value for `property1` is `overridden`:
[source,shell]
----
$ mvn spring-boot:run -Dspring-boot.run.jvmArguments="-Dproperty1=overridden"
----
[[run.examples.environment-variables]]
=== Using Environment Variables
Environment variables can be specified using the `environmentVariables` attribute.
The following example sets the 'ENV1', 'ENV2', 'ENV3', 'ENV4' env variables:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$running/environment-variables-pom.xml[tags=environment-variables]
----
If the value is empty or not defined (that is `<MY_ENV/`>), the env variable is set with an empty String as the value.
Maven trims values specified in the pom so it is not possible to specify an env variable which needs to start or end with a space.
Any String typed Maven variable can be passed as system properties.
Any attempt to pass any other Maven variable type (for example a `List` or a `URL` variable) will cause the variable expression to be passed literally (unevaluated).
Environment variables defined this way take precedence over existing values.
[[run.examples.using-application-arguments]]
=== Using Application Arguments
Application arguments can be specified using the `arguments` attribute.
The following example sets two arguments: `property1` and `property2=42`:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$running/application-arguments-pom.xml[tags=application-arguments]
----
On the command-line, arguments are separated by a space the same way `jvmArguments` are.
If an argument contains a space, make sure to quote it.
In the following example, two arguments are available: `property1` and `property2=Hello World`:
[source,shell]
----
$ mvn spring-boot:run -Dspring-boot.run.arguments="property1 'property2=Hello World'"
----
[[run.examples.specify-active-profiles]]
=== Specify Active Profiles
The active profiles to use for a particular application can be specified using the `profiles` argument.
The following configuration enables the `local` and `dev` profiles:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$running/active-profiles-pom.xml[tags=active-profiles]
----
The profiles to enable can be specified on the command line as well, make sure to separate them with a comma, as shown in the following example:
[source,shell]
----
$ mvn spring-boot:run -Dspring-boot.run.profiles=local,dev
----

View File

@@ -0,0 +1,121 @@
[[using]]
= Using the Plugin
Maven users can inherit from the `spring-boot-starter-parent` project to obtain sensible defaults.
The parent project provides the following features:
* Java 17 as the default compiler level.
* UTF-8 source encoding.
* Compilation with `-parameters`.
* A dependency management section, inherited from the `spring-boot-dependencies` POM, that manages the versions of common dependencies.
This dependency management lets you omit `<version>` tags for those dependencies when used in your own POM.
* An execution of the <<goals.adoc#packaging.repackage-goal, `repackage` goal>> with a `repackage` execution id.
* A `native` profile that configures the build to be able to generate a Native image.
* Sensible https://maven.apache.org/plugins/maven-resources-plugin/examples/filter.html[resource filtering].
* Sensible plugin configuration (https://github.com/ktoso/maven-git-commit-id-plugin[Git commit ID], and https://maven.apache.org/plugins/maven-shade-plugin/[shade]).
* Sensible resource filtering for `application.properties` and `application.yml` including profile-specific files (for example, `application-dev.properties` and `application-dev.yml`)
NOTE: Since the `application.properties` and `application.yml` files accept Spring style placeholders (`${...}`), the Maven filtering is changed to use `@..@` placeholders.
(You can override that by setting a Maven property called `resource.delimiter`.)
[NOTE]
====
The `spring-boot-starter-parent` sets the `maven.compiler.release` property, which restricts the `--add-exports`, `--add-reads`, and `--patch-module` options https://openjdk.org/jeps/247[if they modify system modules].
In case you need to use those options, unset `maven.compiler.release`:
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
----
<maven.compiler.release></maven.compiler.release>
----
and then configure the source and the target options instead:
[source,xml,indent=0,subs="verbatim,quotes,attributes"]
----
<maven.compiler.source>${java.version}</maven.compiler.source>
<maven.compiler.target>${java.version}</maven.compiler.target>
----
====
[[using.parent-pom]]
== Inheriting the Starter Parent POM
To configure your project to inherit from the `spring-boot-starter-parent`, set the `parent` as follows:
[source,xml,subs="verbatim,quotes,attributes"]
----
<!-- Inherit defaults from Spring Boot -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>{version-spring-boot}</version>
</parent>
----
NOTE: You should need to specify only the Spring Boot version number on this dependency.
If you import additional starters, you can safely omit the version number.
With that setup, you can also override individual dependencies by overriding a property in your own project.
For instance, to use a different version of the SLF4J library and the Spring Data release train, you would add the following to your `pom.xml`:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$using/different-versions-pom.xml[tags=different-versions]
----
Browse the xref:appendix:dependency-versions/properties.adoc[Dependency Versions Properties] section in the Spring Boot reference for a complete list of dependency version properties.
[[using.import]]
== Using Spring Boot without the Parent POM
There may be reasons for you not to inherit from the `spring-boot-starter-parent` POM.
You may have your own corporate standard parent that you need to use or you may prefer to explicitly declare all your Maven configuration.
If you do not want to use the `spring-boot-starter-parent`, you can still keep the benefit of the dependency management (but not the plugin management) by using an `import` scoped dependency, as follows:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$using/no-starter-parent-pom.xml[tags=no-starter-parent]
----
The preceding sample setup does not let you override individual dependencies by using properties, as explained above.
To achieve the same result, you need to add entries in the `dependencyManagement` section of your project **before** the `spring-boot-dependencies` entry.
For instance, to use a different version of the SLF4J library and the Spring Data release train, you could add the following elements to your `pom.xml`:
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$using/no-starter-parent-override-dependencies-pom.xml[tags=no-starter-parent-override-dependencies]
----
[[using.overriding-command-line]]
== Overriding settings on the command-line
The plugin offers a number of user properties, starting with `spring-boot`, to let you customize the configuration from the command-line.
For instance, you could tune the profiles to enable when running the application as follows:
[source,shell]
----
$ mvn spring-boot:run -Dspring-boot.run.profiles=dev,local
----
If you want to both have a default while allowing it to be overridden on the command-line, you should use a combination of a user-provided project property and MOJO configuration.
[source,xml,indent=0,subs="verbatim,attributes"]
----
include::example$using/default-and-override-pom.xml[tags=default-and-override]
----
The above makes sure that `local` and `dev` are enabled by default.
Now a dedicated property has been exposed, this can be overridden on the command-line as well:
[source,shell]
----
$ mvn spring-boot:run -Dapp.profiles=test
----

View File

@@ -0,0 +1,11 @@
* xref:maven-plugin:index.adoc[]
** xref:maven-plugin:getting-started.adoc[]
** xref:maven-plugin:using.adoc[]
** xref:maven-plugin:goals.adoc[]
** xref:maven-plugin:packaging.adoc[]
** xref:maven-plugin:build-image.adoc[]
** xref:maven-plugin:run.adoc[]
** xref:maven-plugin:aot.adoc[]
** xref:maven-plugin:integration-tests.adoc[]
** xref:maven-plugin:build-info.adoc[]
** xref:maven-plugin:help.adoc[]