Use basedir as forked JVM's working directory in Maven plugin
Fixes gh-16811
This commit is contained in:
parent
32e1d68d2f
commit
60d60a8304
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2017 the original author or authors.
|
||||
* Copyright 2012-2019 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
|
@ -16,10 +16,12 @@
|
|||
|
||||
package org.test;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
public class SampleApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("I haz been run");
|
||||
System.out.println("I haz been run from '" + new File("").getAbsolutePath() + "'");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,3 +1,3 @@
|
|||
def file = new File(basedir, "build.log")
|
||||
return file.text.contains("I haz been run")
|
||||
return file.text.contains("I haz been run from '$basedir'")
|
||||
|
||||
|
|
|
@ -281,7 +281,10 @@ public abstract class AbstractRunMojo extends AbstractDependencyFilterMojo {
|
|||
addClasspath(args);
|
||||
args.add(startClassName);
|
||||
addArgs(args);
|
||||
runWithForkedJvm(this.workingDirectory, args, determineEnvironmentVariables());
|
||||
runWithForkedJvm(
|
||||
(this.workingDirectory != null) ? this.workingDirectory
|
||||
: this.project.getBasedir(),
|
||||
args, determineEnvironmentVariables());
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue