2015-07-03 13 views
1

我認爲問題是mvn找不到java或類似的東西。Yosemite上的Maven安裝失敗:在此環境中沒有提供編譯器

如果我運行Java的版本

java version "1.8.0_45" 
Java(TM) SE Runtime Environment (build 1.8.0_45-b14) 
Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode) 

Maven的:

Apache Maven 3.3.3 (7994120775791599e205a5524ec3e0dfe41d4a06; 2015-04-22T13:57:37+02:00) 
Maven home: /Users/rubenortiz/apache-maven-3.3.3 
Java version: 1.8.0_45, vendor: Oracle Corporation 
Java home: /Library/Internet Plug-Ins/JavaAppletPlugin.plugin/Contents/Home 
Default locale: es_ES, platform encoding: UTF-8 
OS name: "mac os x", version: "10.10.3", arch: "x86_64", family: "mac" 


[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 5.003 s 
[INFO] Finished at: 2015-07-03T13:09:44+02:00 
[INFO] Final Memory: 23M/302M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.3:compile (default-compile) on project core: 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 
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command 
[ERROR] mvn <goals> -rf :core 

回答

3

嘗試的javac -version ...

,因爲「也許你在一個JRE,而不是JDK運行'...看起來沒有編譯器。

/庫/互聯網插件/ JavaAppletPlugin.plugin /內容/家是Java是由逃走了...不鏈接到JDK,但到互聯網插件

也許安裝JDK或更改JAVA_HOME

2

問題很簡單。您的java版本查詢報告JRE。由於maven錯誤指出它需要JDK。安裝JDK並相應地調整環境變量。