今天在使用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:Javajre7..lib ools.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:UsersAdministrator>mvn -v
Apache Maven 3.0.5 (r01de14724cdef164cd33c7c8c2fe155faf9602da; 2013-02-19 21:51:
28+0800)
Maven home: D:apache-maven-3.0.5-binapache-maven-3.0.5in..
Java version: 1.7.0_67, vendor: Oracle Corporation
Java home: D:Javajdk1.7.0_67jre
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里面重新打包居然可以了 ,很是神奇有木有!!!