Skip to content

Commit 8ba26ca

Browse files
committed
Add ability to customize working directory of forked process
1 parent 832678c commit 8ba26ca

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/main/java/org/scalatest/tools/maven/AbstractScalaTestMojo.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,13 @@ abstract class AbstractScalaTestMojo extends AbstractMojo {
224224
*/
225225
double spanScaleFactor = 1.0;
226226

227+
/**
228+
* The current working directory for forked process. Optional. If not specified, basedir will be used.
229+
*
230+
* @parameter property="workingDirectory"
231+
*/
232+
String workingDirectory;
233+
227234
// runScalaTest is called by the concrete mojo subclasses TODO: make it protected and others too
228235
// Returns true if all tests pass
229236
boolean runScalaTest(String[] args) throws MojoFailureException {
@@ -259,7 +266,11 @@ private boolean runWithoutForking(String[] args) {
259266
private boolean runForkingOnce(String[] args) throws MojoFailureException {
260267

261268
final Commandline cli = new Commandline();
262-
cli.setWorkingDirectory(project.getBasedir());
269+
if ((this.workingDirectory == null || this.workingDirectory.isEmpty())) {
270+
cli.setWorkingDirectory(project.getBasedir());
271+
} else {
272+
cli.setWorkingDirectory(workingDirectory);
273+
}
263274
cli.setExecutable(getJvm());
264275

265276
// Set up environment

0 commit comments

Comments
 (0)