Commit 60d60a83 authored by Andy Wilkinson's avatar Andy Wilkinson

Use basedir as forked JVM's working directory in Maven plugin

Fixes gh-16811
parent 32e1d68d
/*
* 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() + "'");
}
}
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());
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment