tools.jar问题无法执行目标org.apache.maven.plugins:maven-compiler-plugin

时间:2017-05-27 16:08:37

标签: java maven pom.xml

运行:     mvn install

出现此错误:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-
plugin:2.5.1:compile (default-compile) on project 1: Fatal error 
compiling: 
tools.jar not found: C:\Program Files\Java\jre1.8.0_131\..\lib\tools.jar -> 
[Help 1]

POM文件区域错误:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.5.1</version>
            <inherited>true</inherited>

            <configuration>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
        </plugin>

当我查看C:\ Program Files \ Java时,我没有在JRE lib文件夹下看到tools.jar。我在JDK lib文件夹下看到它

1 个答案:

答案 0 :(得分:2)

您正在使用JRE,请使用JDK编译您的代码

How to set a java compiler in Netbeans