Add jvmArguments property to maven plugin

The maven plugin now forks a new process when it starts a boot app. This
makes remote debugging of the app impossible without the ability to pass
extra JVM arguments.

This commit adds a "jvmArguments" attribute to the RunMojo that defines
additional JVM arguments to set on the forked process.

Fixes gh-848
This commit is contained in:
Stephane Nicoll
2014-05-14 13:26:11 +02:00
parent 5249f54c5a
commit a93784207e
9 changed files with 239 additions and 4 deletions

View File

@@ -0,0 +1,54 @@
-----
Debug the application
-----
Stephane Nicoll
-----
2014-05-14
-----
The <<<run>>> goal forks a process for the boot application. It is possible to specify jvm arguments
to that forked process. The following configuration suspend the process until a debugger has joined
on port 5005
---
<project>
...
<build>
...
<plugins>
...
<plugin>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
<version>${project.version}</version>
<executions>
<execution>
<goals>
<goal>run</goal>
</goals>
<configuration>
<jvmArguments>
-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005
</jvmArguments>
</configuration>
</execution>
</executions>
...
</plugin>
...
</plugins>
...
</build>
...
</project>
---
These arguments can be specified on the command line as well, make sure to wrap that properly,
that is:
---
mvn spring-boot:run -Drun.jvmArguments="-Xdebug -Xrunjdwp:transport=dt_socket,server=y,suspend=y,address=5005"
---

View File

@@ -40,6 +40,8 @@ Spring Boot Maven Plugin
* {{{./examples/exclude-dependency.html}Exclude a dependency}}
* {{{./examples/run-debug.html}Debug the application}}
[]

View File

@@ -99,6 +99,10 @@ Usage
mvn spring-boot:run
---
The application is forked in a separate process. If you need to specify some JVM arguments
(i.e. for debugging purposes), you can use the <<<jvmArguments>>> parameter, see
{{{./examples/run-debug.html}Debug the application}} for more details.
By default, any <<src/main/resources>> folder will be added to the application classpath
when you run the application. 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

View File

@@ -9,6 +9,7 @@
<menu name="Examples">
<item name="Custom repackage classifier" href="examples/repackage-classifier.html"/>
<item name="Exclude a dependency" href="examples/exclude-dependency.html"/>
<item name="Debug the application" href="examples/run-debug.html"/>
</menu>
<menu ref="reports"/>
</body>