首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Checkstyle 10.3.1不会在7.5级上运行

Checkstyle 10.3.1不会在7.5级上运行
EN

Stack Overflow用户
提问于 2022-07-17 14:41:15
回答 2查看 856关注 0票数 2
代码语言:javascript
运行
复制
plugins {
   id("checkstyle")
}

implementation("com.puppycrawl.tools:checkstyle:10.3.1")

checkstyleMain {
    source = ["src/main/java"]
}

// Upgraded
checkstyle {
    toolVersion "10.3.1"
    configFile = file("config/checkstyle/checkstyle.xml")
}

任务:checkstyleMain失败

代码语言:javascript
运行
复制
FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':checkstyleMain'.
> A failure occurred while executing org.gradle.api.plugins.quality.internal.CheckstyleAction
   > Unable to create Root Module: config {/Users/NOTiFY/IdeaProjects/GoStopHandle/config/checkstyle/checkstyle.xml}, classpath {null}.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.5/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 3s

openjdk版本"18.0.1“2022-04-19

/usr/local/c业力/gradle/7.5/bin/gradle /usr/local/Cellar/gradle/7.5/libexec/bin/gradle /usr/local/c业力/gradle/7.5/libexec/docs/ (2521个文件)/usr/local/files/gradle/7.5/libexec/lib/(233个文件) /usr/local/Cellar/gradle/7.5/libexec/src/ (8579个文件)

/usr/local/Cellar/checkstyle/10.3.1/bin/checkstyle /usr/local/Cellar/checkstyle/10.3.1/libexec/checkstyle-10.3.1-all.jar

增加了:

代码语言:javascript
运行
复制
gradle build clean --stacktrace 

错误:

代码语言:javascript
运行
复制
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: cannot initialize module TreeWalker - cannot initialize module JavadocMethod - Property 'scope' does not exist, please check the documentation
        at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:478)
        at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:201)
        at com.puppycrawl.tools.checkstyle.ant.CheckstyleAntTask.createRootModule(CheckstyleAntTask.java:424)
        ... 34 more
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: cannot initialize module JavadocMethod - Property 'scope' does not exist, please check the documentation
        at com.puppycrawl.tools.checkstyle.TreeWalker.setupChild(TreeWalker.java:128)
        at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:201)
        at com.puppycrawl.tools.checkstyle.Checker.setupChild(Checker.java:473)
        ... 36 more
Caused by: com.puppycrawl.tools.checkstyle.api.CheckstyleException: Property 'scope' does not exist, please check the documentation
        at com.puppycrawl.tools.checkstyle.api.AutomaticBean.tryCopyProperty(AutomaticBean.java:227)
        at com.puppycrawl.tools.checkstyle.api.AutomaticBean.configure(AutomaticBean.java:194)
        at com.puppycrawl.tools.checkstyle.TreeWalker.setupChild(TreeWalker.java:123)
        ... 38 more
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2022-07-20 08:59:24

票数 0
EN

Stack Overflow用户

发布于 2022-07-19 11:05:28

这是Checkstyle告诉您配置文件(checkstyle.xml)有问题的非常糟糕的方式。按照输出的建议,使用--stacktrace (简称-S )运行,看看配置的实际问题是什么。

此外,指定要使用的Check样式版本的方法如下所示:

代码语言:javascript
运行
复制
checkstyle {
    toolVersion('10.3.1')
}

相反,您所做的是意外地在您自己的项目类路径中包含了Checkstyle库。因此,您现在可能正在使用Gradle中的默认版本8.x。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73012720

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档