2013-08-02 14:36:58 +08:00
|
|
|
# Spring Boot - Maven Plugin
|
2013-07-19 17:53:13 +08:00
|
|
|
|
2013-08-06 08:06:07 +08:00
|
|
|
> **Note:** We are currently still working on documentation for Spring Boot. This
|
|
|
|
|
> README is not yet complete, please check back in the future.
|
|
|
|
|
|
2013-07-20 00:30:45 +08:00
|
|
|
A maven plugin for building executable JAR and WAR files. To use it,
|
2013-07-19 17:53:13 +08:00
|
|
|
configure your project to build a JAR or WAR (as appropriate) in the
|
2013-07-20 00:30:45 +08:00
|
|
|
normal way, and then add the Spring plugin to your `<build><plugins>`
|
|
|
|
|
section
|
2013-07-19 17:53:13 +08:00
|
|
|
|
|
|
|
|
`pom.xml`
|
2013-07-20 00:30:45 +08:00
|
|
|
|
2013-07-19 17:53:13 +08:00
|
|
|
```xml
|
|
|
|
|
<plugin>
|
2013-07-26 18:50:02 +08:00
|
|
|
<groupId>org.springframework.boot</groupId>
|
2013-07-19 17:53:13 +08:00
|
|
|
<artifactId>spring-package-maven-plugin</artifactId>
|
|
|
|
|
<version>{{project.version}}</version>
|
|
|
|
|
<executions>
|
|
|
|
|
<execution>
|
|
|
|
|
<goals>
|
|
|
|
|
<goal>package</goal>
|
|
|
|
|
</goals>
|
|
|
|
|
</execution>
|
|
|
|
|
</executions>
|
|
|
|
|
</plugin>
|
|
|
|
|
```
|
2013-07-20 00:30:45 +08:00
|
|
|
|
|
|
|
|
The net effect of that is to enhance your existing archive with the
|
|
|
|
|
Spring Launcher during the Maven `package` phase. The main class will
|
|
|
|
|
be selected from the existing `MANIFEST.MF` if there is one, or else
|
|
|
|
|
the plugin will attempt to guess based on the contents of the local
|
|
|
|
|
`src/main/java` source tree.
|
|
|
|
|
|
|
|
|
|
So to build and run a project artifact you do something like this:
|
|
|
|
|
|
|
|
|
|
```
|
|
|
|
|
$ mvn package
|
|
|
|
|
$ java -jar target/*.jar
|
|
|
|
|
...
|
|
|
|
|
<application runs>
|
|
|
|
|
```
|