This question already has an answer here:
No compiler is provided in this environment. When execute mvn clean package
                                
                                    (1个答案)
                                
                        
                3年前关闭。
            
        

我从命令行运行mvn compile并得到以下信息:

[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: 04:12 min
[INFO] Finished at: 2017-02-24T10:19:32+00:00
[INFO] Final Memory: 24M/247M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.1:compile (default-compile) on project spring-boot-sam
ple-atmosphere: Compilation failure
[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?


我已经看到了这个答案,但这是针对Eclipse的。

有什么建议

最佳答案

将JDK而不是JRE设置为环境(必要时下载)

JDK = JRE + Codingstuff(包括编译器)

关于java - mvn compile-[错误]在此环境中未提供编译器。也许您是在JRE而不是JDK上运行? ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/42437232/

10-10 14:32