java Missing artifact com.sun:tools:jar 1.8.0 终极解决方法

原因分析

在使用springboot2.0+ 继承shiro和redis时,maven报错:

Missing artifact com.sun:tools:jar:1.8.0

如下图:
在这里插入图片描述
在这里插入图片描述
选中项目–>右键 -->“Properties”–>“Java Build Path”在这里插入图片描述
tools包是java自带的,并不会被maven引入项目中。

解决办法

手动引入该tools包即可

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

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

posted on 2020-06-30 10:50  疯狂的小萝卜头  阅读(8123)  评论(1编辑  收藏  举报