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
This commit is contained in:
Phillip Webb 2014-12-15 13:08:17 -08:00
parent 9f31e09cf0
commit f4fbc3e339
1 changed files with 4 additions and 3 deletions

View File

@ -168,8 +168,10 @@ public class RunMojo extends AbstractDependencyFilterMojo {
}
private void run(String startClassName) throws MojoExecutionException {
if (this.fork || (this.agent != null && this.agent.length > 0)
|| (this.jvmArguments != null && this.jvmArguments.length() > 0)) {
findAgent();
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);
}
else {
@ -204,7 +206,6 @@ public class RunMojo extends AbstractDependencyFilterMojo {
}
private void addAgents(List<String> args) {
findAgent();
if (this.agent != null) {
getLog().info("Attaching agents: " + Arrays.asList(this.agent));
for (File agent : this.agent) {