[ 
https://issues.apache.org/jira/browse/MPMD-386?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17863204#comment-17863204
 ] 

Matthias Bünger commented on MPMD-386:
--------------------------------------

Got time to try something else today: As a solution until Maven 4 one could use 
a semi-visible variable

{code}${session.executionRootDirectory}{code}

So I have a workaround until Maven 4 and can upgrade the plugin. Will try to 
create a reproducer IT over the weekend.


> Resolution of suppression file failes using the "-f" parameter since 3.15.0
> ---------------------------------------------------------------------------
>
>                 Key: MPMD-386
>                 URL: https://issues.apache.org/jira/browse/MPMD-386
>             Project: Maven PMD Plugin
>          Issue Type: Bug
>          Components: PMD
>    Affects Versions: 3.15.0, 3.16.0, 3.17.0, 3.18.0, 3.19.0, 3.20.0, 3.21.0
>            Reporter: Matthias Bünger
>            Priority: Major
>         Attachments: meta-pom.xml
>
>
> 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
> {code}
> /
> ├─ src/
> │  ├─ ...
> ├─ pom.xml
> ├─ exclude-pmd.properties
>  
> /
> ├─ componentDir
>    ├─ src/
>    │  ├─ ...
>    ├─ pom.xml
>    ├─ exclude-pmd.properties
> {code}
> Same for multi module
> {code}
> /
> ├─ moduleA
> │  ├─src/
> │  │  ├─ ...
> ├─ moduleb
> │  ├─src/
> │  │  ├─ ...
> ├─ pom.xml
> ├─ exclude-pmd.properties
> /
> ├─ componentDir
>   ├─ moduleA
>   │  ├─src/
>   │  │  ├─ ...
>   ├─ moduleb
>   │  ├─src/
>   │  │  ├─ ...
>   ├─ pom.xml
>   ├─ exclude-pmd.properties
> {code}
> 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
> {code:xml}
>   <reporting>
>     <plugins>
>       <plugin>
>         <groupId>org.apache.maven.plugins</groupId>
>         <artifactId>maven-checkstyle-plugin</artifactId>
>         <configuration>
>           
> <suppressionsLocation>checkstyle-suppressions.xml</suppressionsLocation>
>         </configuration>
>       </plugin>
>     </plugins>
>   </reporting>
> {code}
> 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
> {code:xml}
>   <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>
> {code}
> where "path.to.suppressfile.wo.slash" is
> {code:xml}
> 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>
> {code}
> 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
> {code:xml}
> <excludeFromFailureFile>exclude-pmd.properties</excludeFromFailureFile>
> {code}
> 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.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to