Commit f4fbc3e3 authored by Phillip Webb's avatar Phillip Webb

Fix Maven Spring Loaded detection logic

Ensure that the Maven plugin RunMojo attempts to detect the Spring
Loaded agent before deciding if the JVM should be forked.

Fixes gh-2140
parent 9f31e09c
...@@ -168,8 +168,10 @@ public class RunMojo extends AbstractDependencyFilterMojo { ...@@ -168,8 +168,10 @@ public class RunMojo extends AbstractDependencyFilterMojo {
} }
private void run(String startClassName) throws MojoExecutionException { private void run(String startClassName) throws MojoExecutionException {
if (this.fork || (this.agent != null && this.agent.length > 0) findAgent();
|| (this.jvmArguments != null && this.jvmArguments.length() > 0)) { boolean hasAgent = (this.agent != null && this.agent.length > 0);
boolean hasJvmArgs = (this.jvmArguments != null && this.jvmArguments.length() > 0);
if (this.fork || hasAgent || hasJvmArgs) {
runWithForkedJvm(startClassName); runWithForkedJvm(startClassName);
} }
else { else {
...@@ -204,7 +206,6 @@ public class RunMojo extends AbstractDependencyFilterMojo { ...@@ -204,7 +206,6 @@ public class RunMojo extends AbstractDependencyFilterMojo {
} }
private void addAgents(List<String> args) { private void addAgents(List<String> args) {
findAgent();
if (this.agent != null) { if (this.agent != null) {
getLog().info("Attaching agents: " + Arrays.asList(this.agent)); getLog().info("Attaching agents: " + Arrays.asList(this.agent));
for (File agent : this.agent) { for (File agent : this.agent) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment