我最近买了一台 Macbook Air,它现在正在运行 Mountain Lion,但我在运行公司的项目时遇到了一些问题,唯一一个在工作中使用 mac 的人在他的 Macbook Pro 上运行 Lion,他没有这样的问题。正如标题所说,在命令行上编译项目没有问题,但是当我尝试在 IntelliJ 中编译它时,我得到了这个错误
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (requireJS-Optimizer) on project MarfeelTouch: Command execution failed. Cannot run program "node" (in directory "/Users/pedrompg/Documents/Marfeel/MarfeelTouch"): error=2, No such file or directory -> [Help 1]
当我从命令行编译它并尝试运行程序时也会出现问题
Caused by: java.util.concurrent.ExecutionException: java.io.IOException: Cannot run program "phantomjs" (in directory "/Users/pedrompg/Documents/Tenants/vhosts/discoverint"): error=2, No such file or directory
at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:232) ~[na:1.6.0_35]
at java.util.concurrent.FutureTask.get(FutureTask.java:91) ~[na:1.6.0_35]
at com.marfeel.pressSystem.impl.SectionPressImpl.getAllItemsFromSectionFeeds(SectionPressImpl.java:137) ~[MarfeelPressSystem-1.0.jar:na]
... 29 common frames omitted
看来我无法从项目内部运行任何命令行程序
这就是我们 phantomJS 的调用方式:
private Process buildProcess() throws IOException {
Process process;
String[] invocationCmd = getInvocationCmd();
if (executionDirectory != null) {
if (LOG.isDebugEnabled()) {
LOG.info("Invoking PhantomJS with {} in {}.", Arrays.toString(invocationCmd), executionDirectory);
}
process = Runtime.getRuntime().exec(invocationCmd, null,
new File(executionDirectory));
} else {
if (LOG.isDebugEnabled()) {
LOG.info("Invoking PhantomJS with {} in {}.", Arrays.toString(invocationCmd));
}
process = Runtime.getRuntime().exec(invocationCmd, null);
}
return process;
}
getInvocationCmd() 返回以下数组
[phantomjs,--load-images=no,--disk-cache=yes,--max-disk-cache-size=1048576,/Users/pedrompg/Documents/Marfeel/MarfeelHub/target/webapp/WEB-INF/classes/whiteCollar.js,marca/marca.js,http://www.marca.com/]
不知道有没有留下相关资料我们在项目上使用Maven、tomcat 7、nodeJS、phantomJS 1.5、nginx 1.2.4、java 1.6.0_35
希望有人可以提供帮助,我真的很担心这个问题,已经浪费了 2 天时间来解决这个问题。
提前致谢