Error message:
1. Missing artifact jdk.tools:jdk.tools:jar:1.8 [Maven Dependency Problem]
2. The container 'Maven Dependencies' references non existing library 'D:\.m2\repository\jdk\tools\jdk.tools\1.8\jdk.tools-1.8.jar'
需要引入Maven依赖,如下所示:
<dependency> <groupId>jdk.tools</groupId> <artifactId>jdk.tools</artifactId> <version>1.8</version> <scope>system</scope> <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath> </dependency>
其中:tools.jar包是JDK自带的。
(大话)原因:假设当前项目的pom.xml文件依赖 ABC.jar包,其中ABC.jar包隐式依赖tools.jar包,而tools.jar并没有在本地仓库,所以要在我们的工程中增加如上依赖。