我正在构建一个用于自动化服务器端过程的Java程序。通常情况下我会进入“桌面/GIT/”目录并使用以下maven命令:“mvn integration-test -DskipTests -P interactive -e”。
我正在构建一个java程序,并尝试运行该命令行,但迄今为止我没有成功。
目前的代码如下:
public static void main(String[] args) throws FileNotFoundException {
// TODO Auto-generated method stub
Process theProcess = null;
try
{
theProcess = Runtime.getRuntime().exec("mvn integration-test -DskipTests -P interactive -e");
}
catch(IOException e)
{
System.err.println("Error on exec() method");
e.printStackTrace();
}
// read from the called program's standard output stream
try
{
inStream = new BufferedReader(new InputStreamReader( theProcess.getInputStream()));
System.out.println(inStream.readLine());
}
catch(IOException e)
{
System.err.println("Error on inStream.readLine()");
e.printStackTrace();
}
break;
}
}
in.close();
}