Added workingDir parameter
git-svn-id: https://hyracks.googlecode.com/svn/branches/hyracks_hadoop_compat_changes@478 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks-maven-plugin/src/main/java/edu/uci/ics/hyracks/maven/plugin/AbstractHyracksMojo.java b/hyracks-maven-plugin/src/main/java/edu/uci/ics/hyracks/maven/plugin/AbstractHyracksMojo.java
index b60e378..972f584 100644
--- a/hyracks-maven-plugin/src/main/java/edu/uci/ics/hyracks/maven/plugin/AbstractHyracksMojo.java
+++ b/hyracks-maven-plugin/src/main/java/edu/uci/ics/hyracks/maven/plugin/AbstractHyracksMojo.java
@@ -24,7 +24,7 @@
import org.apache.maven.plugin.MojoExecutionException;
public abstract class AbstractHyracksMojo extends AbstractMojo {
- protected Process launch(File command, String options) throws MojoExecutionException {
+ protected Process launch(File command, String options, File workingDir) throws MojoExecutionException {
if (!command.isFile()) {
throw new MojoExecutionException(command.getAbsolutePath() + " is not an executable program");
}
@@ -35,7 +35,7 @@
if (osName.startsWith("Windows")) {
return launchWindowsBatch(command, options);
} else {
- return launchUnixScript(command, options);
+ return launchUnixScript(command, options, workingDir);
}
} catch (IOException e) {
throw new MojoExecutionException("Error executing command: " + command.getAbsolutePath(), e);
@@ -51,7 +51,7 @@
return proc;
}
- protected Process launchUnixScript(File command, String options) throws IOException {
+ protected Process launchUnixScript(File command, String options, File workingDir) throws IOException {
String[] optionsArray = new String[0];
if (options != null && !options.trim().isEmpty()) {
optionsArray = options.trim().split("\\s+");
@@ -61,7 +61,8 @@
for (int i = 0; i < optionsArray.length; ++i) {
commandWithOptions[i + 1] = optionsArray[i];
}
- Process proc = Runtime.getRuntime().exec(commandWithOptions, null, new File("."));
+ Process proc = Runtime.getRuntime().exec(commandWithOptions, null,
+ workingDir == null ? new File(".") : workingDir);
dump(proc.getInputStream());
dump(proc.getErrorStream());
return proc;
diff --git a/hyracks-maven-plugin/src/main/java/edu/uci/ics/hyracks/maven/plugin/AbstractHyracksServerMojo.java b/hyracks-maven-plugin/src/main/java/edu/uci/ics/hyracks/maven/plugin/AbstractHyracksServerMojo.java
index 4260dcd..448ca22 100644
--- a/hyracks-maven-plugin/src/main/java/edu/uci/ics/hyracks/maven/plugin/AbstractHyracksServerMojo.java
+++ b/hyracks-maven-plugin/src/main/java/edu/uci/ics/hyracks/maven/plugin/AbstractHyracksServerMojo.java
@@ -22,4 +22,9 @@
* @required
*/
protected File hyracksServerHome;
+
+ /**
+ * @parameter
+ */
+ protected File workingDir;
}
\ No newline at end of file
diff --git a/hyracks-maven-plugin/src/main/java/edu/uci/ics/hyracks/maven/plugin/HyracksCCStartMojo.java b/hyracks-maven-plugin/src/main/java/edu/uci/ics/hyracks/maven/plugin/HyracksCCStartMojo.java
index 5808909..942b055 100644
--- a/hyracks-maven-plugin/src/main/java/edu/uci/ics/hyracks/maven/plugin/HyracksCCStartMojo.java
+++ b/hyracks-maven-plugin/src/main/java/edu/uci/ics/hyracks/maven/plugin/HyracksCCStartMojo.java
@@ -37,7 +37,7 @@
cmdLineBuffer.append("-port ").append(port);
}
String args = cmdLineBuffer.toString();
- final Process proc = launch(new File(hyracksServerHome, makeScriptName(HYRACKS_CC_SCRIPT)), args);
+ final Process proc = launch(new File(hyracksServerHome, makeScriptName(HYRACKS_CC_SCRIPT)), args, workingDir);
HyracksServiceRegistry.INSTANCE.addServiceProcess(proc);
try {
Thread.sleep(2000);
diff --git a/hyracks-maven-plugin/src/main/java/edu/uci/ics/hyracks/maven/plugin/HyracksNCStartMojo.java b/hyracks-maven-plugin/src/main/java/edu/uci/ics/hyracks/maven/plugin/HyracksNCStartMojo.java
index 2f1a268..1206e08 100644
--- a/hyracks-maven-plugin/src/main/java/edu/uci/ics/hyracks/maven/plugin/HyracksNCStartMojo.java
+++ b/hyracks-maven-plugin/src/main/java/edu/uci/ics/hyracks/maven/plugin/HyracksNCStartMojo.java
@@ -58,7 +58,7 @@
cmdLineBuffer.append(" -cc-port ").append(ccPort);
}
String args = cmdLineBuffer.toString();
- final Process proc = launch(new File(hyracksServerHome, makeScriptName(HYRACKS_NC_SCRIPT)), args);
+ final Process proc = launch(new File(hyracksServerHome, makeScriptName(HYRACKS_NC_SCRIPT)), args, workingDir);
HyracksServiceRegistry.INSTANCE.addServiceProcess(proc);
try {
Thread.sleep(2000);