Java-11在指定路径下找不到工件com.sun:tools:jar:1.7.0

时间:2020-06-12 13:31:09

标签: maven java-11 checkstyle tools.jar maven-checkstyle-plugin

我已使用maven build将项目从Java 8升级到11,但出现以下错误,然后添加了 带有checkstyle依赖的maven-checkstyle-plugin。我不确定要添加哪个版本的Checkstyle来解决此问题。

Could not find artifact com.sun:tools:jar:1.7.0 at specified path C:\Program Files\Java\jdk-11.0.1/../lib/tools.jar
Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:checkstyle (checkstyle-run) on project reconciliation: Execution checkstyle-run of goal org.apache.maven.plugins:maven-checkstyle-plugin:2.17:checkstyle failed: Plugin org.apache.maven.plugins:maven-checkstyle-plugin:2.17 or one of its dependencies could not be resolved: Could not find artifact com.sun:tools:jar:1.7.0 at specified path C:\Program Files\Java\jdk-11.0.1/../lib/tools.jar -> [Help 1]
[ERROR] 

已添加Maven插件

  <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-checkstyle-plugin</artifactId>
                <version>3.1.1</version>
                <dependencies>
                    <dependency>
                        <groupId>com.puppycrawl.tools</groupId>
                        <artifactId>checkstyle</artifactId>
                        <version>8.33</version>
                    </dependency>
                </dependencies>
            </plugin>

具有checkstyle 8.33

    Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.1.1:checkstyle (checkstyle-run) on project recon-server: Execution checkstyle-run of goal org.apache.maven.plugins:maven-checkstyle-plugin:3.1.1:checkstyle failed: A required class was missing while executing org.apache.maven.plugins:maven-checkstyle-plugin:3.1.1:checkstyle: com/puppycrawl/tools/checkstyle/checks/metrics/AbstractComplexityCheck

使用checkstyle 7.6

    Failed to execute goal org.apache.maven.plugins:maven-checkstyle-plugin:3.1.1:checkstyle (checkstyle-run) on project recon-server: Execution checkstyle-run of goal org.apache.maven.plugins:maven-checkstyle-plugin:3.1.1:checkstyle failed: A required class was missing while executing org.apache.maven.plugins:maven-checkstyle-plugin:3.1.1:checkstyle: com/puppycrawl/tools/checkstyle/api/AutomaticBean$OutputStreamOptions

0 个答案:

没有答案