shell 脚本执行mvn clean install 报错 --MissingProjectException

12月12日北京OSC源创会 —— 开源技术的年终盛典 »  

[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 

我在shell里面写入cd 到我的mvn工程下,然后进行编译打包,结果执行错误,但是我在另一个脚本里面执行是没有问题的

 
解决办法:
 
Shell 里面使用 cd 是没有用处的。建议你在 bash 中使用
mvn -f $YOUR_PROJECT_DIR/pom.xml clean install

或者继续在 bash 中使用 cd,然后这样执行(记住前面还有个点)

. ./your_shell_script_file.sh

 

 
posted @ 2015-11-17 11:03  feng_2015  阅读(3579)  评论(0编辑  收藏  举报