diff --git a/baeldung-pmd-rules.xml b/baeldung-pmd-rules.xml
new file mode 100644
index 0000000000..7625d68242
--- /dev/null
+++ b/baeldung-pmd-rules.xml
@@ -0,0 +1,10 @@
+
+
+ Baeldung custom PMD rules
+
+ Test does not follow Baeldung naming convention
+ 3
+
+
\ No newline at end of file
diff --git a/custom-pmd/README.md b/custom-pmd/README.md
new file mode 100644
index 0000000000..065a1128f3
--- /dev/null
+++ b/custom-pmd/README.md
@@ -0,0 +1 @@
+## Custom PMD Rules
diff --git a/custom-pmd/pom.xml b/custom-pmd/pom.xml
new file mode 100644
index 0000000000..7438ec0a34
--- /dev/null
+++ b/custom-pmd/pom.xml
@@ -0,0 +1,43 @@
+
+ 4.0.0
+ org.baeldung.pmd
+ custom-pmd
+ 0.0.1-SNAPSHOT
+ jar
+ custom-pmd
+ http://maven.apache.org
+
+
+ UTF-8
+ 3.7.0
+ 6.0.1
+
+
+
+
+ net.sourceforge.pmd
+ pmd-core
+ ${pmdVersion}
+
+
+ net.sourceforge.pmd
+ pmd-java
+ ${pmdVersion}
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-compiler-plugin
+ ${maven-compiler-plugin.version}
+
+ 1.8
+ 1.8
+
+
+
+
+
\ No newline at end of file
diff --git a/custom-pmd/src/main/java/org/baeldung/pmd/UnitTestNamingConventionRule.java b/custom-pmd/src/main/java/org/baeldung/pmd/UnitTestNamingConventionRule.java
new file mode 100644
index 0000000000..863d3c9348
--- /dev/null
+++ b/custom-pmd/src/main/java/org/baeldung/pmd/UnitTestNamingConventionRule.java
@@ -0,0 +1,32 @@
+package org.baeldung.pmd;
+
+import net.sourceforge.pmd.lang.java.ast.ASTClassOrInterfaceDeclaration;
+import net.sourceforge.pmd.lang.java.rule.AbstractJavaRule;
+
+import java.util.Arrays;
+import java.util.List;
+import java.util.Objects;
+
+public class UnitTestNamingConventionRule extends AbstractJavaRule {
+
+ private static List allowedEndings = Arrays.asList(
+ "IntegrationTest",
+ "LongRunningUnitTest",
+ "ManualTest",
+ "JdbcTest",
+ "LiveTest");
+
+ public Object visit(ASTClassOrInterfaceDeclaration node, Object data) {
+ String className = node.getImage();
+ Objects.requireNonNull(className);
+
+ if (className.endsWith("Test") || className.endsWith("Tests")) {
+ if (allowedEndings.stream()
+ .noneMatch(className::endsWith)) {
+ addViolation(data, node);
+ }
+ }
+
+ return data;
+ }
+}
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 205d4d2e97..ae2efe5161 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1,5 +1,6 @@
-
+
4.0.0
com.baeldung
parent-modules
@@ -27,7 +28,18 @@
1.6.0
+
+
+
+ org.apache.maven.plugins
+ maven-jxr-plugin
+ 2.3
+
+
+
+
+ custom-pmd
parent-boot-5
asm
atomix
@@ -49,7 +61,7 @@
bootique
cdi
-
+
core-java
core-java-io
core-java-8
@@ -63,12 +75,12 @@
ethereumj
-
+
feign
flips
-
+
geotools
testing-modules/groovy-spock
@@ -88,12 +100,12 @@
httpclient
hystrix
-
+
immutables
influxdb
jackson
-
+
vavr
java-lite
java-rmi
@@ -104,7 +116,7 @@
javafx
jgroups
jee-7
-
+
jjwt
jpa-storedprocedure
jsf
@@ -114,9 +126,7 @@
testing-modules/junit-5
jws
-
+
libraries-data
linkrest
logging-modules/log-mdc
@@ -124,9 +134,8 @@
logging-modules/log4j2
logging-modules/logback
lombok
-
mapstruct
-
+ metrics
maven
mesos-marathon
testing-modules/mockito
@@ -145,7 +154,6 @@
persistence-modules/querydsl
-
reactor-core
persistence-modules/redis
testing-modules/rest-assured
@@ -160,7 +168,7 @@
spring-5
spring-5-reactive
spring-5-mvc
-
+ spring-5-security
spring-activiti
spring-akka
spring-amqp
@@ -199,7 +207,7 @@
spring-integration
spring-jenkins-pipeline
spring-jersey
-
+
spring-jms
spring-jooq
persistence-modules/spring-jpa
@@ -290,7 +298,7 @@
lucene
vraptor
persistence-modules/java-cockroachdb
- spring-security-thymeleaf
+ spring-security-thymeleaf
persistence-modules/java-jdbi
jersey
java-spi
@@ -354,7 +362,7 @@
-
+
org.codehaus.mojo
exec-maven-plugin
@@ -363,7 +371,7 @@
maven
-
+
org.apache.maven.plugins
maven-surefire-plugin
@@ -380,7 +388,7 @@
-
+
org.apache.maven.plugins
maven-compiler-plugin
@@ -390,9 +398,41 @@
1.8
-
+
+ org.apache.maven.plugins
+ maven-pmd-plugin
+ 3.9.0
+
+
+ org.baeldung.pmd
+ custom-pmd
+ 0.0.1-SNAPSHOT
+
+
+
+ 5
+ true
+ false
+ true
+ true
+ true
+ UTF-8
+ 1.8
+
+ ${user.dir}/baeldung-pmd-rules.xml
+
+
+
+
+ compile
+
+ check
+
+
+
+
-
+
com.vackosar.gitflowincrementalbuilder
@@ -400,7 +440,6 @@
3.4
-
+
-