1. 程式人生 > >使用maven打包項目遇到錯誤: http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

使用maven打包項目遇到錯誤: http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

splay family 錯誤 str bsp RM spa exce exec

今天在使用maven打包項目時遇到一個錯誤:
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.4:compile (default-compile) on project zjydpt: Fatal error compiling: tools.jar not found: D:\Java\jre7..\lib\tools.jar -> [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/MojoExecutionException
我使用的是
C:\Users\Administrator>mvn -v
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 21:51:
28+0800)
Maven home: D:\apache-maven-3.0.5-bin\apache-maven-3.0.5\bin..
Java version: 1.7.0_67, vendor: Oracle Corporation
Java home: D:\Java\jdk1.7.0_67\jre
Default locale: zh_CN, platform encoding: GBK
OS name: “windows 7”, version: “6.1”, arch: “amd64”, family: “windows”
直接從eclipse裏面打包會報錯可以嘗試使用:
1、在eclipse裏面右鍵項目-run as-maven build-在彈出框Goals裏面直接輸入clean進行清理 ,然後輸入package進行打包,不用加mvn前綴(PS:估計是maven版本問題吧!)
2、在硬盤裏找到你的項目,然後按住shift右鍵選擇‘在此處打開命令窗口’,然後輸入mvn clean清理,再輸入mvn package進行打包。

我是使用第二種方法進行打包的,打包完成之後發現在eclipse裏面重新打包居然可以了 ,很是神奇有木有!!!

使用maven打包項目遇到錯誤: http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException