2011-02-25 105 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」或類似的東西。