Details
-
Bug
-
Status: Open
-
Major
-
Resolution: Unresolved
-
3.15.0, 3.16.0, 3.17.0, 3.18.0, 3.19.0, 3.20.0, 3.21.0
-
None
-
None
Description
I finally upgraded the maven-pmd-update of our meta POM, because I always forgot to upgrade this particular one too. I tried to upgrade from 3.12.0 to 3.21.0, but realized that our local and CI builds break after upgrading, becuase our exclude files are not found anymore, when using the "-f" parameter.
I could nail it down that the break comes with 3.15.0, but I can not explain why. The only ticket I could imagine to has something to do with it is MPMD-323, but this is of 3.16.0, so I might be wrong at all.
Background and setup:
We have tons of Maven projects within own repositories, each with one of the four structure:
a) Single or multi-module project
b) Root-pom in root directory or in a folder below
The pmd-excludes file lies in same folder as the root-pom. So we have the following setups
Single-module
/ ├─ src/ │ ├─ ... ├─ pom.xml ├─ exclude-pmd.properties / ├─ componentDir ├─ src/ │ ├─ ... ├─ pom.xml ├─ exclude-pmd.properties
Same for multi module
/ ├─ moduleA │ ├─src/ │ │ ├─ ... ├─ moduleb │ ├─src/ │ │ ├─ ... ├─ pom.xml ├─ exclude-pmd.properties / ├─ componentDir ├─ moduleA │ ├─src/ │ │ ├─ ... ├─ moduleb │ ├─src/ │ │ ├─ ... ├─ pom.xml ├─ exclude-pmd.properties
As we have so many Maven projects we don't create individual Jenkins pipelines for each of them due the massive amount of work needed to maintain them. The call this in one of the two ways, depending on the the pipeline (verify or site), both using the "-f" parameter. On local developer machines we just start the build in die root pom directory without the "-f" parameter.
While the resolution of the suppression file of the maven checkstyle plugin works like a charm by only using this
<reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-checkstyle-plugin</artifactId> <configuration> <suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation> </configuration> </plugin> </plugins> </reporting>
The resolution of the suppression file of the pmd plugin worked somehow different, so we used the following universal approach to make it work for all our projects
<reporting> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-pmd-plugin</artifactId> <configuration> <excludeFromFailureFile>${path.to.suppressfile.wo.slash}/exclude-pmd.properties</excludeFromFailureFile> </configuration> </plugin> </plugins> </reporting>
where "path.to.suppressfile.wo.slash" is
multi-module <path.to.suppressfile.wo.slash>${project.basedir}/..</path.to.suppressfile.wo.slash> single-module <path.to.suppressfile.wo.slash>${project.basedir}</path.to.suppressfile.wo.slash>
This worked until 3.14.0, but failed after I upgraded to 3.15.0 in local and Jenkins builds.
I could make the local build work again by changing the configuration to the same as the checkstyle plugin
<excludeFromFailureFile>exclude-pmd.properties</excludeFromFailureFile>
When I looked at the changes made in MPMD-323, it seems to only affect the ruleset file, but it seems to also affects the suppression file, as the maven build fails when using the "-f" parameter.
As this is my first time I get closer in contact with the PMD plugin sources I can't provide any more information right but, except the fact that the checkstyle plugin never had these kind of issues starting to use it in 2016 up to current version 3.3.0.
Full example meta-pom attached.