此内容没有您所选择的语言版本。
Appendix B. Spring Boot Maven Plug-In
B.1. Spring Boot Maven Plugin Overview
This appendix describes the Spring Boot Maven Plugin. It provides the Spring Boot support in Maven and allows you to package the executable jar or war archives and run an application in-place
.
B.2. Goals
The Spring Boot Plugin includes the following goals:
-
spring-boot:run
runs your Spring Boot application. -
spring-boot:repackage
repackages your.jar
and.war
files to be executable. -
spring-boot:start
andspring-boot:stop
both are used to manage the lifecycle of your Spring Boot application. -
spring-boot:build-info
generates build information that can be used by the Actuator.
B.3. Usage
You can find general instructions on how to use the Spring Boot Plugin at: http://docs.spring.io/spring-boot/docs/current/maven-plugin/usage.html
. Following is an example that illustrates the usage of the spring-boot-maven-plugin
plugin:
<project> <modelVersion>4.0.0</modelVersion> <groupId>io.fabric8.quickstarts</groupId> <artifactId>spring-boot-camel</artifactId> <version>1.0-SNAPSHOT</version> <name>Fabric8 :: Quickstarts :: Spring-Boot :: Camel</name> <description>Spring Boot example running a Camel route</description> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <!-- configure the versions you want to use here --> <fuse.version>7.2.0.fuse-720020-redhat-00001</fuse.version> <fabric8.version>3.0.11.fuse-720027-redhat-00001</fabric8.version> <spring-boot.version>1.5.16.RELEASE</spring-boot.version> <!-- maven plugin versions --> <fabric8.maven.plugin.version>3.5.33.fuse-720026-redhat-00001</fabric8.maven.plugin.version> <maven-compiler-plugin.version>3.3</maven-compiler-plugin.version> <maven-surefire-plugin.version>2.18.1</maven-surefire-plugin.version> </properties> <dependencyManagement> <dependencies> <dependency> <groupId>io.fabric8</groupId> <artifactId>fabric8-project-bom-camel-spring-boot</artifactId> <version>${fabric8.version}</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <dependencies> <!-- Enabling health checks --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.apache.camel</groupId> <artifactId>camel-spring-boot-starter</artifactId> </dependency> <!-- testing --> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework</groupId> <artifactId>spring-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.jboss.arquillian.junit</groupId> <artifactId>arquillian-junit-container</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>io.fabric8</groupId> <artifactId>fabric8-arquillian</artifactId> <scope>test</scope> </dependency> </dependencies> <build> <defaultGoal>spring-boot:run</defaultGoal> <plugins> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>${maven-compiler-plugin.version}</version> <configuration> <source>1.8</source> <target>1.8</target> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-surefire-plugin</artifactId> <version>${maven-surefire-plugin.version}</version> <inherited>true</inherited> <configuration> <excludes> <exclude>**/*KT.java</exclude> </excludes> </configuration> </plugin> <plugin> <groupId>org.jboss.redhat-fuse</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>${fuse.version}</version> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> <plugin> <groupId>io.fabric8</groupId> <artifactId>fabric8-maven-plugin</artifactId> <version>${fabric8.maven.plugin.version}</version> <executions> <execution> <goals> <goal>resource</goal> <goal>build</goal> </goals> </execution> </executions> </plugin> </plugins> </build> </project>
For more information on Spring Boot Maven Plugin, refer the http://docs.spring.io/spring-boot/docs/current/maven-plugin
link.