找不到工件 com.sun:tools:jar:0 [英] Could not find artifact com.sun:tools:jar:0

查看:48
本文介绍了找不到工件 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 FilesJavajdk-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 :/

推荐答案

tools.jar 从 Java 9+ 中移除

您使用的是 JDK 11.在那里找不到 tools.jar.

tools.jar removed from Java 9+

You're on JDK 11. No tools.jar found there.

JEP 220:模块化运行时图像tools.jarrt.jar 来自 lib 文件夹,从 Java 9.

JEP 220: Modular Run-Time Images removed both tools.jar and rt.jar from the lib folder, as of Java 9.

移除: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.

此更改是添加 Java 平台模块系统,又名 Project Jigsaw.

This change is part of adding the Java Platform Module System, a.k.a. Project Jigsaw.

要升级Checkstyle,请使用更高版本,例如:

To upgrade Checkstyle, use later versions, such as:

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

咨询 Maven 存储库,了解 Apache 的版本Maven Checkstyle 插件Checkstyle.

Consult a Maven repo for versions of Apache Maven Checkstyle Plugin and of Checkstyle.

这篇关于找不到工件 com.sun:tools:jar:0的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆