Could not find artifact com.sun:tools:jar:0

风格不统一 提交于 2020-03-10 05:04:11

问题


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]

I do not have a tools.jar into my JDK (i have jdk-11.0.2).

I'm on it since 2H, please help :/


回答1:


You're on JDK 11.
The JEP 220 removed both tools.jar and rt.jar from the lib folder.

Removed: rt.jar and tools.jar

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.

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>

See the inner dependency block.



来源:https://stackoverflow.com/questions/55207885/could-not-find-artifact-com-suntoolsjar0

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!