2016-11-23 35 views
0

我一直在使用Jenkins和Maven來運行一些自動化作業,但最近我發現控制檯日誌在乾淨安裝過程中一直顯示相同的錯誤。我嘗試更新JAVA_HOME和其他各種各樣的東西,但都沒有工作。即使作業完成並通過構建將只是失敗原因的錯誤在這裏:Jenkins Maven項目在此環境中沒有提供編譯器

Executing Maven: -B -f D:\jenkins\workspace\DummyTesting\pom.xml clean install 
[INFO] Scanning for projects... 
[INFO]                   
[INFO] ------------------------------------------------------------------------ 
[INFO] Building automation 1.0-SNAPSHOT 
[INFO] ------------------------------------------------------------------------ 
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ automation --- 
[INFO] Deleting D:\jenkins\workspace\DummyTesting\target 
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @  automation --- 
[INFO] Using 'UTF-8' encoding to copy filtered resources. 
[INFO] skip non existing resourceDirectory D:\jenkins\workspace \DummyTesting\src\main\resources 
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ automation --- 
[INFO] No sources to compile 
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ automation --- 
[INFO] Using 'UTF-8' encoding to copy filtered resources. 
[INFO] Copying 1 resource 
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ automation --- 
[INFO] Changes detected - recompiling the module! 
[INFO] Compiling 51 source files to D:\jenkins\workspace\DummyTesting\target\test-classes 
[INFO] ------------------------------------------------------------- 
[ERROR] COMPILATION ERROR : 
[INFO] ------------------------------------------------------------- 
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? 
[INFO] 1 error 
[INFO] ------------------------------------------------------------- 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 3.679 s 
[INFO] Finished at: 2016-11-22T15:17:57+08:00 
[INFO] Final Memory: 9M/23M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:testCompile (default-testCompile) on project automation: Compilation failure 
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK? 
[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 
+1

可以顯示什麼配置爲JAVA_HOME這份工作? (你可以在構建的環境變量中看到它) –

+0

查看消息*也許你正在使用JRE而不是JDK?*。 JRE不會編譯工具,您必須將JDK設置爲* JAVA_HOME * – Tome

+0

這是我在其中一個節點C:\ Program Files(x86)\ Java \ jdk1.8.0_91上爲JAVA_HOME配置的內容 –

回答

0

看起來像詹金斯無法挑選jdk。請檢查您的JAVA_HOME是否已設置並指向JDK。

你也可以嘗試從詹金斯UI如下設置JAVA_HOME:

Go To Jenkins -> Manage Jenkins -> Configure System -> JDK. Configure path to the JDK under JAVA_HOME field. 
相關問題