找不到工件com.sun:工具:jar:0

问题描述 投票:1回答:1

我正在尝试使用checkstyle和findbugs做mvn checkstyle:checkstyle但我有这个错误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)。

我从2H开始,请帮忙:/

java maven checkstyle findbugs maven-checkstyle-plugin
1个回答
3
投票

你是JDK 11。 JEP 220tools.jar文件夹中删除了rt.jarlib

删除:rt.jar和tools.jar

先前存储在lib / rt.jar,lib / tools.jar,lib / dt.jar和各种其他内部JAR文件中的类和资源文件现在以更有效的格式存储在lib目录中的特定于实现的文件中。这些文件的格式未指定,如有更改,恕不另行通知。

升级Checkstyle使用

<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块。

© www.soinside.com 2019 - 2024. All rights reserved.