2011-02-25 127 views
0

我使用弹簧进行开发。并且我使用eclipse.Earlier我的项目已成功构建,但由于我在某些软件包中粘贴了一些更多文件,当我说运行为“Maven Package”时,我真的不明白为什么这个错误会在几次之间进行。任何人都可以帮我解决我的问题。maven package(构建错误),同时构建项目

,当我说作为Maven的软件包运行

[INFO] Scanning for projects... 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building HeyLets 0.8-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] --- maven-resources-plugin:2.4.3:resources (default-resources) @ HeyLets --- 
[WARNING] Using platform encoding (Cp1252 actually) to copy filtered resources, i.e. build is platform dependent! 
[INFO] Copying 2 resources 
[INFO] 
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) @ HeyLets --- 
[WARNING] File encoding has not been set, using platform encoding Cp1252, i.e. build is platform dependent! 
[INFO] Compiling 1 source file to D:\temp\temp_wsp\HeyLetsNew\target\classes 
[INFO] ------------------------------------------------------------- 
[ERROR] COMPILATION ERROR : 
[INFO] ------------------------------------------------------------- 
[ERROR] Unable to locate the Javac Compiler in: 
    C:\Program Files\Java\jre6\..\lib\tools.jar 
Please ensure you are using JDK 1.4 or above and 
not a JRE (the com.sun.tools.javac.Main class is required). 
In most cases you can change the location of your Java 
installation by setting the JAVA_HOME environment variable. 
[INFO] 1 error 
[INFO] ------------------------------------------------------------- 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 2.156s 
[INFO] Finished at: Fri Feb 25 11:04:37 IST 2011 
[INFO] Final Memory: 3M/15M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.3.2:compile (default-compile) on project HeyLets: Compilation failure 
[ERROR] Unable to locate the Javac Compiler in: 
[ERROR] C:\Program Files\Java\jre6\..\lib\tools.jar 
[ERROR] Please ensure you are using JDK 1.4 or above and 
[ERROR] not a JRE (the com.sun.tools.javac.Main class is required). 
[ERROR] In most cases you can change the location of your Java 
[ERROR] installation by setting the JAVA_HOME environment variable. 
[ERROR] -> [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/MojoFailureException 

感谢我获得以下错误, 约杰什乔杜里

+0

什么是JAVA_HOME设置为? – Raghuram 2011-02-25 07:50:13

+0

JAVA_HOME指向C:\ Program Files \ Java \ jdk1.6.0_23 – user469999 2011-02-26 04:04:23

回答

0

也许你正面临this线程讨论同样的问题。如果是这样,则线程中也会建议一种解决方法。

1

我按照Raghuram指出的线程中的指示解决了问题。 您必须将使用的JRE更改为JDK中的JRE。

转到偏好设置/ Java /已安装的JRE并添加一个位置“C:\Program Files\Java\jdk1.6.0_27\jre”或类似的东西。 删除“C:\Program Files\Java\jre6”。

再次运行你的maven脚本,正如你所看到的,问题解决了!

1

[错误]找不到javac编译器中: C:\ PROGRAMFILES \的Java \ JRE6 .. \ LIB \ tools.jar中

使用JDK JRE: C:\ Program Files文件\ Java \ jdk1.6.0_27 \ jre($ BaseDir)

现在路径jre \ .. \ lib \ tools.jar是对的。 (..指父目录)

$的BaseDir \ JRE \ .. \ LIB \ tools.jar中等于$的BaseDir \ LIB \ tools.jar中

在Eclipse转到Windows - >首选项 - >爪哇 - >已安装的JRE

并将位置添加或更改为 “C:\ Program Files \ Java \ jdk1.6.0_27 \ jre”或类似的东西。