Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add ability to customize working directory of forked process #83

Merged
merged 1 commit into from
Jul 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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