PMD gradle 插件无法识别安全规则集

问题描述

出于某种原因,PMD 无法识别安全规则集,但适用于所有其他规则集。

关于 build.gradle 文件

pmd {
toolVersion = "6.21.0"
rulePriority = 5 //priority threshold
ignoreFailures = true //this will prevent the gradle build to fail if there are pmd violations.
consoleOutput = false //print to console instead of html file.
ruleSets = [] 
ruleSetConfig = resources.text.fromFile("pmd_config.xml") //in this file you can configure the rules.
}

在 pmd_config.xml 文件上:

  <ruleset name="Custom Rules"
    xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 https://pmd.sourceforge.io/ruleset_2_0_0.xsd">

    <description>
        My custom rules
    </description>



        <rule ref="category/java/bestpractices.xml">
        </rule>
        <rule ref="category/java/codestyle.xml">
        </rule>
        <rule ref="category/java/design.xml">
        </rule>
        <rule ref="category/java/documentation.xml">
        </rule>
        <rule ref="category/java/errorprone.xml">
        </rule>
        <rule ref="category/java/multithreading.xml">
        </rule>
        <rule ref="category/java/performance.xml">
        </rule>
        <rule ref="category/java/security.xml">
        </rule>

</ruleset>

它成功地找到了其余的类别,但不是为了安全。如果我尝试只使用安全规则集,我会收到一条错误消息,说它不知道“安全”是什么,我再次测试了我的错别字,还尝试在安全规则集中明确提及规则并得到相同的结果。 此规则集是否已弃用?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)