Maven錯誤:[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?的解決方法


錯誤:

[ERROR] No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?

解決方法:

1、如果是Eclipse時,應該是安裝好JDK后Eclipse默認使用的是JRE,所以只要調節回來即可。

兩種方式都可行:

②、

2、如果一個Maven項目導入Eclipse之后,而上面又沒有設置成JDK的路徑時,此時也會出現如上錯誤,那么解決方法就是把Eclipse自動生成的文件全部刪除,只保留遠程Maven的目錄結構。

3、還可以直接針對插件制定版本,比如在POM上增加如下插件的配置:

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-compiler-plugin</artifactId>
    <version>3.1</version>
    <configuration>
        <fork>true</fork>
        <executable>D:\Java\jdk1.7.0_17\bin\javac.exe</executable>
    </configuration>
</plugin>

不過不建議使用這種方法,版本和路徑不容易在每台機器上控制。

 

參考:

https://stackoverflow.com/questions/19655184/no-compiler-is-provided-in-this-environment-perhaps-you-are-running-on-a-jre-ra

http://blog.csdn.net/fox_lht/article/details/16369147


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM