Modified maven plugin to use command line interface
git-svn-id: https://hyracks.googlecode.com/svn/branches/hyracks_hadoop_compat_changes@482 123451ca-8445-de46-9d55-352943316053
diff --git a/hyracks-maven-plugin/pom.xml b/hyracks-maven-plugin/pom.xml
index ef59b9d..0972bca 100644
--- a/hyracks-maven-plugin/pom.xml
+++ b/hyracks-maven-plugin/pom.xml
@@ -32,12 +32,5 @@
<type>jar</type>
<scope>compile</scope>
</dependency>
- <dependency>
- <groupId>edu.uci.ics.hyracks</groupId>
- <artifactId>hyracks-cli</artifactId>
- <version>0.1.6-SNAPSHOT</version>
- <type>jar</type>
- <scope>compile</scope>
- </dependency>
</dependencies>
</project>
diff --git a/hyracks-maven-plugin/src/main/java/edu/uci/ics/hyracks/maven/plugin/AbstractHyracksCLIMojo.java b/hyracks-maven-plugin/src/main/java/edu/uci/ics/hyracks/maven/plugin/AbstractHyracksCLIMojo.java
index 379c6da..7f3faef 100644
--- a/hyracks-maven-plugin/src/main/java/edu/uci/ics/hyracks/maven/plugin/AbstractHyracksCLIMojo.java
+++ b/hyracks-maven-plugin/src/main/java/edu/uci/ics/hyracks/maven/plugin/AbstractHyracksCLIMojo.java
@@ -14,14 +14,21 @@
*/
package edu.uci.ics.hyracks.maven.plugin;
-import org.apache.maven.plugin.AbstractMojo;
+import java.io.File;
+import java.io.PrintWriter;
+
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
-import edu.uci.ics.hyracks.cli.CommandExecutor;
-import edu.uci.ics.hyracks.cli.Session;
+public abstract class AbstractHyracksCLIMojo extends AbstractHyracksMojo {
+ private static final String HYRACKS_CLI_SCRIPT = "bin" + File.separator + "hyrackscli";
-public abstract class AbstractHyracksCLIMojo extends AbstractMojo {
+ /**
+ * @parameter
+ * @required
+ */
+ protected File hyracksCLIHome;
+
/**
* @parameter
* @required
@@ -35,10 +42,16 @@
@Override
public void execute() throws MojoExecutionException, MojoFailureException {
+ StringBuilder buffer = new StringBuilder();
+ buffer.append(createConnectCommand());
+ buffer.append('\n');
+ buffer.append(getCommands());
+ final Process proc = launch(new File(hyracksCLIHome, makeScriptName(HYRACKS_CLI_SCRIPT)), null, null);
try {
- Session session = new Session();
- CommandExecutor.execute(session, createConnectCommand());
- CommandExecutor.execute(session, getCommands());
+ PrintWriter out = new PrintWriter(proc.getOutputStream());
+ out.println(buffer.toString());
+ out.close();
+ proc.waitFor();
} catch (Exception e) {
throw new MojoExecutionException(e.getMessage());
}