Skip to content

Commit

Permalink
Add ability to customize working directory of forked process
Browse files Browse the repository at this point in the history
  • Loading branch information
GrigorievNick committed Apr 14, 2021
1 parent 832678c commit 6b0c06a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<groupId>org.scalatest</groupId>
<artifactId>scalatest-maven-plugin</artifactId>
<packaging>maven-plugin</packaging>
<version>2.0.2</version>
<version>2.0.3</version>
<name>ScalaTest Maven Plugin</name>
<description>Integrates ScalaTest into Maven</description>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,13 @@ abstract class AbstractScalaTestMojo extends AbstractMojo {
*/
double spanScaleFactor = 1.0;

/**
* The current working directory for forked process. Optional. If not specified, basedir will be used.
*
* @parameter property="workingDirectory"
*/
String workingDirectory;

// runScalaTest is called by the concrete mojo subclasses TODO: make it protected and others too
// Returns true if all tests pass
boolean runScalaTest(String[] args) throws MojoFailureException {
Expand Down Expand Up @@ -259,7 +266,11 @@ private boolean runWithoutForking(String[] args) {
private boolean runForkingOnce(String[] args) throws MojoFailureException {

final Commandline cli = new Commandline();
cli.setWorkingDirectory(project.getBasedir());
if ((this.workingDirectory == null || this.workingDirectory.isEmpty())) {
cli.setWorkingDirectory(project.getBasedir());
} else {
cli.setWorkingDirectory(workingDirectory);
}
cli.setExecutable(getJvm());

// Set up environment
Expand Down

0 comments on commit 6b0c06a

Please sign in to comment.