The Spring Boot Maven plugin connects a Spring Boot application to Maven build tasks. It lets you run the application during development, package it as an executable JAR, and build a container image. section 1.2.2 section 18.3
For an executable JAR, the plugin:
- Provides a Maven goal for running the application. section 1.2.2
- Includes dependency libraries in the JAR so they are available at runtime. section 1.2.2
- Writes a manifest identifying the application’s bootstrap class as the JAR’s main class. section 1.2.2
Run or package an application
From the project directory, run `./mvnw spring-boot:run` to start the application through Maven. To make and launch an executable JAR, run `./mvnw package`, then `java -jar target/taco-cloud-0.0.1-SNAPSHOT.jar`. section 1.2.2
For deployment, `mvnw spring-boot:build-image` builds a container image without a separate Dockerfile. Docker must be installed on the build machine. The default image tag uses the project’s artifact ID and version; supply `-Dspring-boot.build-image.imageName=tacocloud/tacocloud:0.0.19-SNAPSHOT` when you need a repository-specific name. section 18.3
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<image>
<name>tacocloud/${project.artifactId}:${project.version}</name>
</image>
</configuration>
</plugin>
The plugin configuration sets an image name using Maven project properties, so the tag follows the artifact ID and version. section 18.3
