美文网首页程序员
Maven集成p3c-pmd

Maven集成p3c-pmd

作者: 叨叨软件测试 | 来源:发表于2017-10-23 11:03 被阅读0次

    简介

    Maven集成p3c-pmd

    配置

    Pom文件:

    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        
        <build>
            <plugins>
                <plugin>
                    <groupId>org.apache.maven.plugins</groupId>
                    <artifactId>maven-pmd-plugin</artifactId>
                    <version>3.8</version>
                    <configuration>
                        <rulesets>
                            <ruleset>rulesets/java/ali-comment.xml</ruleset>
                            <ruleset>rulesets/java/ali-concurrent.xml</ruleset>
                            <ruleset>rulesets/java/ali-constant.xml</ruleset>
                            <ruleset>rulesets/java/ali-exception.xml</ruleset>
                            <ruleset>rulesets/java/ali-flowcontrol.xml</ruleset>
                            <ruleset>rulesets/java/ali-naming.xml</ruleset>
                            <ruleset>rulesets/java/ali-oop.xml</ruleset>
                            <ruleset>rulesets/java/ali-orm.xml</ruleset>
                            <ruleset>rulesets/java/ali-other.xml</ruleset>
                            <ruleset>rulesets/java/ali-set.xml</ruleset>
                        </rulesets>
                        <printFailingErrors>true</printFailingErrors>
                    </configuration>
                    <executions>
                        <execution>
                            <goals>
                                <goal>check</goal>
                            </goals>
                        </execution>
                    </executions>
                    <dependencies>
                        <dependency>
                            <groupId>com.alibaba.p3c</groupId>
                            <artifactId>p3c-pmd</artifactId>
                            <version>1.3.0</version>
                        </dependency>
                    </dependencies>
                </plugin>
            </plugins>
        </build>
    </project>
    

    执行

    mvn pmd:pmd
    

    报告

    image.png

    参考文档

    Maven PMD Plugin官方文档:http://maven.apache.org/plugins/maven-pmd-plugin
    p3c官方文档:https://github.com/alibaba/p3c

    微信公众号:daodaotest

    相关文章

      网友评论

        本文标题:Maven集成p3c-pmd

        本文链接:https://www.haomeiwen.com/subject/mlwouxtx.html