[ci] Only run PMD twice instead of three times during build

pmd:check executes implicitly pmd:pmd, but with
the default configuration. For execution
"pmd-test" this means, we called pmd:pmd twice:
Once within "pmd-test" to check test code and
once more via pmd:check, but against the main code.

Skipping now the default configuration always
and explicitly call pmd:pmd in the two
executions.

Thanks @uhafner for the idea.
This commit is contained in:
Andreas Dangel 2024-05-03 20:26:05 +02:00
parent 516b305e50
commit ef19659cb6
No known key found for this signature in database
GPG Key ID: 93450DF2DF9A3FA3

26
pom.xml
View File

@ -506,9 +506,22 @@
<id>pmd-main</id>
<phase>verify</phase>
<goals>
<goal>pmd</goal>
<goal>check</goal>
<goal>cpd</goal>
<goal>cpd-check</goal>
</goals>
<configuration>
<skip>${pmd.skip}</skip>
<minimumTokens>100</minimumTokens>
<rulesets>
<ruleset>/net/sourceforge/pmd/pmd-dogfood-config.xml</ruleset>
</rulesets>
<excludeRoots>
<excludeRoot>target/generated-sources/javacc</excludeRoot>
<excludeRoot>target/generated-sources/antlr4</excludeRoot>
</excludeRoots>
</configuration>
</execution>
<execution>
<id>pmd-test</id>
@ -518,6 +531,7 @@
<goal>check</goal>
</goals>
<configuration>
<skip>${pmd.skip}</skip>
<targetDirectory>${project.build.directory}/pmdTest/</targetDirectory>
<includeTests>true</includeTests>
<rulesets>
@ -528,19 +542,15 @@
</executions>
<configuration>
<linkXRef>false</linkXRef>
<minimumTokens>100</minimumTokens>
<targetJdk>1.${java.version}</targetJdk>
<rulesets>
<ruleset>/net/sourceforge/pmd/pmd-dogfood-config.xml</ruleset>
</rulesets>
<excludeRoots>
<excludeRoot>target/generated-sources/javacc</excludeRoot>
<excludeRoot>target/generated-sources/antlr4</excludeRoot>
</excludeRoots>
<skipPmdError>false</skipPmdError>
<failurePriority>2</failurePriority>
<failOnViolation>true</failOnViolation>
<printFailingErrors>true</printFailingErrors>
<!-- Skip the default pmd executions, which is triggered by pmd:check and avoid
unnecessary pmd analysis of the main code.
We use executions pmd-main and pmd-test instead and explicitly run pmd:pmd. -->
<skip>true</skip>
</configuration>
<dependencies>
<!-- Note: we can't use a property for the version here due to https://issues.apache.org/jira/browse/MRELEASE-932 -->