找不到工件com.sun:tools:jar:0 [英] Could not find artifact com.sun:tools:jar:0
问题描述
我正在尝试通过执行mvn checkstyle:checkstyle
来使用checkstyle和findbugs,但出现此错误
此错误
I'm trying to use checkstyle and findbugs by doing mvn checkstyle:checkstyle
but I have this error
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]
我的JDK中没有tools.jar(我有jdk-11.0.2).
I do not have a tools.jar into my JDK (i have jdk-11.0.2).
我从2H开始就在这上,请帮助:/
I'm on it since 2H, please help :/
推荐答案
您正在使用JDK11.
JEP 220 从lib
文件夹中删除了tools.jar
和rt.jar
.>
You're on JDK 11.
The JEP 220 removed both tools.jar
and rt.jar
from the lib
folder.
已删除:rt.jar和tools.jar
先前存储在lib/rt.jar中的类和资源文件, lib/tools.jar,lib/dt.jar和其他各种内部JAR文件是 现在以更有效的格式存储在特定于实现的文件中 在lib目录中.这些文件的格式未指定,并且 如有更改,恕不另行通知.
The class and resource files previously stored in lib/rt.jar, lib/tools.jar, lib/dt.jar, and various other internal JAR files are now stored in a more efficient format in implementation-specific files in the lib directory. The format of these files is not specified and is subject to change without notice.
要升级Checkstyle使用
To upgrade Checkstyle use
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>3.0.0</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>8.18</version>
</dependency>
</dependencies>
</plugin>
请参阅内部dependency
块.
这篇关于找不到工件com.sun:tools:jar:0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!