mvn“No compiler is provided in this environment”报错解决方案


整理自No compiler is provided in this environment. Perhaps you are running on a JRE rather than a JDK?
我没用Eclipse,故说明以下两种方法,其中,使用方法二(在此之前使用了方法一)后问题已解决。

方法一:设置环境变量JAVA_HOME的值

如图所示

方法二:更新pom.xml文件的值

设置fork为true且说明JDK的路径

<build>
...
    <plugins>
    ...
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <fork>true</fork>
                <executable>C:Program FilesJavajdk1.8.0_45injavac.exe</executable>
            </configuration>
        </plugin>
    </plugins>
</build>
原文地址:https://www.cnblogs.com/tellw/p/13307580.html