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:
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<groupId>org.springframework.boot.maven.it</groupId>
|
||||
<artifactId>run-jvmargs</artifactId>
|
||||
<version>0.0.1.BUILD-SNAPSHOT</version>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>@project.groupId@</groupId>
|
||||
<artifactId>@project.artifactId@</artifactId>
|
||||
<version>@project.version@</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>run</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<jvmArguments>-Dfoo="value 1" -Dbar=value2</jvmArguments>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -0,0 +1,17 @@
|
||||
package org.test;
|
||||
|
||||
public class SampleApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
String foo = System.getProperty("foo");
|
||||
if (!"value 1".equals(foo)) {
|
||||
throw new IllegalStateException("foo system property mismatch (got [" + foo + "]");
|
||||
}
|
||||
String bar = System.getProperty("bar");
|
||||
if (!"value2".equals(bar)) {
|
||||
throw new IllegalStateException("bar system property mismatch (got [" + bar + "]");
|
||||
}
|
||||
System.out.println("I haz been run");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
def file = new File(basedir, "build.log")
|
||||
return file.text.contains("I haz been run")
|
||||
|
||||
Reference in New Issue
Block a user