shell 脚本执行mvn clean install 报错 --MissingProjectException
[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.324s
[INFO] Finished at: Tue Jun 11 11:02:07 CST 2013
[INFO] Final Memory: 2M/59M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/root). Please verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 0.324s
[INFO] Finished at: Tue Jun 11 11:02:07 CST 2013
[INFO] Final Memory: 2M/59M
[INFO] ------------------------------------------------------------------------
[ERROR] The goal you specified requires a project to execute but there is no POM in this directory (/root). Please verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
我在shell里面写入cd 到我的mvn工程下,然后进行编译打包,结果执行错误,但是我在另一个脚本里面执行是没有问题的
解决办法:
Shell 里面使用 cd 是没有用处的。建议你在 bash 中使用
mvn -f $YOUR_PROJECT_DIR/pom.xml clean install
或者继续在 bash 中使用 cd,然后这样执行(记住前面还有个点)
. ./your_shell_script_file.sh