原因分析
在使用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>