正解:POM依赖中添加

<dependency>
            <groupId>jdk.tools</groupId>
            <artifactId>jdk.tools</artifactId>
            <version>1.8</version>
            <scope>system</scope>
            <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
        </dependency>

错解:

<plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                    <encoding>UTF-8</encoding>
                    <compilerArguments>
                        <verbose />
                        <bootclasspath>${java.home}\\lib\\rt.jar;${java.home}\\lib\\jce.jar</bootclasspath>
                    </compilerArguments>
                </configuration>
            </plugin>

这个会到导致无法检索到java.lang的错误
 

收藏 打印