java找不到工件com。sun:tools:jar:0
我试图通过执行mvn checkstyle:checkstyle
来使用checkstyle和findbugs,但是出现了这个错误
This error
[ERROR] Failed to execute goal on project my-project: Could not resolve dependencies for project default:my-project:jar:1.1: Could not find artifact com.sun:tools:jar:0 at specified path C:\Program Files\Java\jdk-11.0.2/../lib/tools.jar -> [Help 1]
我没有工具。jar到我的JDK中(我有JDK-11.0.2)
我从2小时就开始了,请帮助:/
# 1 楼答案
tools.jar
已从Java 9中删除+你在JDK 11上。没有找到
tools.jar
JEP 220: Modular Run-Time Images从
lib
文件夹中删除了tools.jar
和rt.jar
,从Java 9开始此更改是添加Java Platform Module System的一部分,也称为Project Jigsaw
要升级Checkstyle,请使用更高版本,例如:
请注意内部的
dependency
块有关Apache Maven Checkstyle Plugin和Checkstyle的版本,请咨询Maven repo