You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
1.0 KiB
Markdown
39 lines
1.0 KiB
Markdown
12 years ago
|
# Spring Package Maven Plugin
|
||
11 years ago
|
|
||
11 years ago
|
A maven plugin for building executable JAR and WAR files. To use it,
|
||
11 years ago
|
configure your project to build a JAR or WAR (as appropriate) in the
|
||
11 years ago
|
normal way, and then add the Spring plugin to your `<build><plugins>`
|
||
|
section
|
||
11 years ago
|
|
||
|
`pom.xml`
|
||
11 years ago
|
|
||
11 years ago
|
```xml
|
||
|
<plugin>
|
||
11 years ago
|
<groupId>org.springframework.boot</groupId>
|
||
11 years ago
|
<artifactId>spring-package-maven-plugin</artifactId>
|
||
|
<version>{{project.version}}</version>
|
||
|
<executions>
|
||
|
<execution>
|
||
|
<goals>
|
||
|
<goal>package</goal>
|
||
|
</goals>
|
||
|
</execution>
|
||
|
</executions>
|
||
|
</plugin>
|
||
|
```
|
||
11 years ago
|
|
||
|
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>
|
||
|
```
|