eclipse导入maven项目报错"Missing artifact com.sun.:tools:jar:1.8.0"错误解决方法

一、报错信息eclipse导入maven项目报错"Missing artifact com.sun.:tools:jar:1.8.0"错误解决方法

1.1分析原因

选中项目-->右键 -->"Properties"-->"Java Build Path"

eclipse导入maven项目报错"Missing artifact com.sun.:tools:jar:1.8.0"错误解决方法

二、解决步骤

在报错的pom.xml文件中添加:

 <dependency>
      <groupId>com.sun</groupId>
      <artifactId>tools</artifactId>
      <version>1.8.0_144</version>
      <scope>system</scope>
	  <systemPath>${JAVA_HOME}/lib/tools.jar</systemPath>
 </dependency>

<dependency>
    <groupId>com.sun</groupId>
    <artifactId>tools</artifactId>
    <version>1.8.0_144</version>
    <scope>system</scope>
	<systemPath>C:/Program Files/Java/jdk1.8.0_144/lib/tools.jar</systemPath>
</dependency>

注意:

1.  斜杠都使用“/” 

2. C:/Program Files/Java/jdk1.8.0_144 要按照您实际路径修改该值。