Maven集成p3c-pmd

简介

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.pluginsgroupId>
				<artifactId>maven-pmd-pluginartifactId>
				<version>3.8version>
				<configuration>
					<rulesets>
						<ruleset>rulesets/java/ali-comment.xmlruleset>
						<ruleset>rulesets/java/ali-concurrent.xmlruleset>
						<ruleset>rulesets/java/ali-constant.xmlruleset>
						<ruleset>rulesets/java/ali-exception.xmlruleset>
						<ruleset>rulesets/java/ali-flowcontrol.xmlruleset>
						<ruleset>rulesets/java/ali-naming.xmlruleset>
						<ruleset>rulesets/java/ali-oop.xmlruleset>
						<ruleset>rulesets/java/ali-orm.xmlruleset>
						<ruleset>rulesets/java/ali-other.xmlruleset>
						<ruleset>rulesets/java/ali-set.xmlruleset>
					rulesets>
					<printFailingErrors>trueprintFailingErrors>
				configuration>
				<executions>
					<execution>
						<goals>
							<goal>checkgoal>
						goals>
					execution>
				executions>
				<dependencies>
					<dependency>
						<groupId>com.alibaba.p3cgroupId>
						<artifactId>p3c-pmdartifactId>
						<version>1.3.0version>
					dependency>
				dependencies>
			plugin>
		plugins>
	build>
project>

#执行

mvn pmd:pmd

参考文档

http://maven.apache.org/plugins/maven-pmd-plugin
https://github.com/alibaba/p3c

原创公众号:daodaotest

你可能感兴趣的:(p3c)