如何下载用于Maven PMD插件的PMD_RUULESET文件?

发布于 2025-02-10 18:10:06 字数 1237 浏览 1 评论 0 原文

我正在尝试在我的代码库中添加Maven PMD插件。在POM文件中添加了以下代码,但不确定在哪里下载PMD_RULESET.xml文件。

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-pmd-plugin</artifactId>
    <version>3.17.0</version>
    <configuration>
        <rulesets>
            <ruleset>../pmd_ruleset.xml</ruleset>
        </rulesets>
        <targetJdk>11</targetJdk>
    </configuration>
    <executions>
        <execution>
            <phase>verify</phase>
            <goals>
                <goal>check</goal>
                <goal>cpd-check</goal>
            </goals>
        </execution>
    </executions>
</plugin> 

实际上,我尝试使用 http://pmd.sourceforge.net/rules/rules/index.html < /a>,但它不起作用。是否有任何方法可以下载pmd_ruleset.xml文件,用于maven-pmd-pmd-plugin artifact版本3.17.0

参考 - https://maven.apache.org/plugins/maven-pmd-plugin/

I am trying to add maven pmd plugin in my codebase. added below code in pom file but not sure where to download the pmd_ruleset.xml file.

<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-pmd-plugin</artifactId>
    <version>3.17.0</version>
    <configuration>
        <rulesets>
            <ruleset>../pmd_ruleset.xml</ruleset>
        </rulesets>
        <targetJdk>11</targetJdk>
    </configuration>
    <executions>
        <execution>
            <phase>verify</phase>
            <goals>
                <goal>check</goal>
                <goal>cpd-check</goal>
            </goals>
        </execution>
    </executions>
</plugin> 

Actually I tried to download using http://pmd.sourceforge.net/rules/index.html but it is not working. Is there any way to download pmd_ruleset.xml file for maven-pmd-plugin artifact version 3.17.0

Reference - https://maven.apache.org/plugins/maven-pmd-plugin/

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

够钟 2025-02-17 18:10:06

maven-pmd-plugin 的最新版本是 href =“ https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-pmd-plugin/3.17.0” rel =“ nofollow noreferrer”> 3.17.0 。默认情况下,它将使用PMD 6.46.0。

使用Maven-PMD-Plugin时,您无需提供自己的规则集。如

PMD插件寄出了默认规则集,该规则集已启用各种规则。规则集可作为/rulesets/java/maven-pmd-plugin-default.xml。

如果您运行 MVN CLEAN验证,则可以在Maven构建目录中查看规则集(对我来说,它是 target/pmd/presutets/maven-pmd-pmd-plugin-default.xml )。您还可以查看在线

如果您想使用自己的规则集,则可以关注PMD的

也可以在线下载一些规则集。例如,您可以在 github 。

maven-pmd-plugin's latest version is 3.17.0. By default, it will use PMD 6.46.0.

When using maven-pmd-plugin, you don't need to provide your own ruleset. As mentioned in Using Rule Sets:

The PMD plugin ships a default rule set, that has various rules enabled. The ruleset is available as /rulesets/java/maven-pmd-plugin-default.xml.

If you run mvn clean verify, you can see the ruleset in your maven build directory (for me it's target/pmd/rulesets/maven-pmd-plugin-default.xml). You can also view it online.

If you'd like to use your own ruleset, you can follow PMD's Making rulesets document and try to make your own ruleset.

It's also possible to download some rulesets online. E.g., you can search PMD rulesets on GitHub.

极致的悲 2025-02-17 18:10:06

插件包含默认规则集文件,因此您可能首先不需要自定义规则集。但是,如果这样做,则有一些选项:

The default ruleset file is included with the plugin, so it's possible you don't need the custom ruleset in the first place. However, if you do, there are some options:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文