Add maven plugin documentation

This commit adds the generated site for the maven plugin alongside
the developer guide and javadoc. The maven plugin is available in
the "/maven-plugin" context.

The advanced information described in the developer guide have
been migrated to the plugin site as most the information is taken
from the code itself, which avoids duplication.

Fixes #749
This commit is contained in:
Stephane Nicoll
2014-05-02 17:51:23 +02:00
committed by Dave Syer
parent a3b422ffc8
commit 888703cf26
12 changed files with 385 additions and 155 deletions

View File

@@ -15,7 +15,7 @@ unsupported build system. If you are just getting started, you might want to rea
[[build-tool-plugins-maven-plugin]]
== Spring Boot Maven plugin
The Spring Boot Maven Plugin provides Spring Boot support in Maven, allowing you to
The {mp-root}/[Spring Boot Maven Plugin] provides Spring Boot support in Maven, allowing you to
package executable jar or war archives and run an application ``in-place''. To use it you
must be using Maven 3 (or better).
@@ -151,145 +151,7 @@ need to mark the embedded container dependencies as ``provided'', e.g:
</project>
----
[[build-tool-plugins-maven-packaging-configuration]]
=== Repackage configuration
The following configuration options are available for the `spring-boot:repackage` goal:
[[build-tool-plugins-maven-packaging-required-params]]
==== Required parameters
[cols="2,4"]
|===
|Name |Description
|`outputDirectory`
|Directory containing the generated archive (defaults to `${project.build.directory}`).
|`finalName`
|Name of the generated archive (defaults to `${project.build.finalName}`).
|===
[[build-tool-plugins-maven-packaging-optional-params]]
==== Optional parameters
[cols="2,4"]
|===
|Name |Description
|`classifier`
|Classifier to add to the generated artifact. If given, the artifact will be attached. If
this is not given, it will merely be written to the output directory according to the
`finalName`. Attaching the artifact allows to deploy it alongside to the original one,
see http://maven.apache.org/plugins/maven-deploy-plugin/examples/deploying-with-classifiers.html[
the maven documentation for more details]
|`mainClass`
|The name of the main class. If not specified will search for a single compiled class
that contains a `main` method.
|`layout`
|The type of archive (which corresponds to how the dependencies are laid out inside it).
Defaults to a guess based on the archive type.
|===
The plugin rewrites your manifest, and in particular it manages the `Main-Class` and
`Start-Class` entries, so if the defaults don't work you have to configure those there
(not in the jar plugin). The `Main-Class` in the manifest is actually controlled by the
`layout` property of the boot plugin, e.g.
[source,xml,indent=0,subs="verbatim,attributes"]
----
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>{spring-boot-version}</version>
<configuration>
<mainClass>${start-class}</mainClass>
<layout>ZIP</layout>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
----
The layout property defaults to a guess based on the archive type (jar or war). For the
`PropertiesLauncher` the layout is ``ZIP'' (even though the output might be a jar file).
TIP: The executable jar format is <<appendix-executable-jar-format.adoc#executable-jar,
described in the appendix>>.
[[build-tool-plugins-maven-running-applications]]
=== Running applications
The Spring Boot Maven Plugin includes a `run` goal which can be used to launch your
application from the command line. Type the following from the root of your Maven
project:
[indent=0]
----
$ mvn spring-boot:run
----
By default, any `src/main/resources` folder will be added to the application classpath
when you run via the maven plugin. This allows hot refreshing of resources which can be
very useful when developing web applications. For example, you can work on HTML, CSS or
JavaScipt 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.
[[build-tool-plugins-maven-run-configuration]]
=== Run configuration
The following configuration options are available for the `spring-boot:run` goal:
[[build-tool-plugins-maven-run-configuration-required-params]]
=== Required parameters
[cols="2,4"]
|===
|Name |Description
|`classesDirectrory`
|Directory containing the classes and resource files that should be packaged into the
archive (defaults to `${project.build.outputDirectory}`).
|===
[[build-tool-plugins-maven-run-configuration-optional-params]]
=== Optional parameters
[cols="2,4"]
|===
|Name |Description
|`arguments` or `-Drun.arguments`
|Arguments that should be passed to the application (comma-separated).
|`addResources` or `-Drun.addResources`
|Add Maven resources to the classpath directly, this allows live in-place editing or
resources. Since resources will be added directly, and via the target/classes folder
they will appear twice if `ClassLoader.getResources()` is called. In practice, however,
most applications call `ClassLoader.getResource()` which will always return the first
resource (defaults to `true`).
|`mainClass`
|The name of the main class. If not specified the first compiled class found that
contains a 'main' method will be used.
|`folders`
|Folders that should be added to the classpath (defaults to
`${project.build.outputDirectory}`).
|===
Advanced configuration options and examples are available in the {mp-root}/[plugin info page].

View File

@@ -25,6 +25,7 @@ Phillip Webb; Dave Syer; Josh Long; Stéphane Nicoll; Rob Winch; Andy Wilkinson;
:dc-spring-boot: {dc-root}/org/springframework/boot
:dc-spring-boot-autoconfigure: {dc-root}/org/springframework/boot/autoconfigure
:dc-spring-boot-actuator: {dc-root}/org/springframework/boot/actuate
:mp-root: http://docs.spring.io/spring-boot/docs/{spring-boot-docs-version}/maven-plugin
:spring-reference: http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle
:spring-security-reference: http://docs.spring.io/spring-security/site/docs/current/reference/htmlsingle
:spring-javadoc: http://docs.spring.io/spring/docs/current/javadoc-api/org/springframework