Jonathan Haber created MNG-7709:
-----------------------------------

             Summary: plexus-utils upgrade changes the way configuration is 
parsed
                 Key: MNG-7709
                 URL: https://issues.apache.org/jira/browse/MNG-7709
             Project: Maven
          Issue Type: Bug
          Components: Core
    Affects Versions: 3.9.0
            Reporter: Jonathan Haber


While upgrading to Maven 3.9.0, we noticed a change in the way some of our pom 
configuration is parsed. This seems to be a very rare edge case that we can 
work around, but I wanted to flag it in case the root cause turns out to have 
more widespread impact. I put together a small repo that demonstrates the issue:
[https://github.com/jhaber/maven-configuration-reproducer] 

Summary of reproducer:
* The parent module configures the shade plugin with an outputFile parameter: 
[link|https://github.com/jhaber/maven-configuration-reproducer/blob/4017887fed8bd9c7abd7174407be56531db912b0/pom.xml#L16-L23]
* The child module inherits from parent and resets the shade plugin 
configuration (using <configuration combine.self="override"/>): 
[link|https://github.com/jhaber/maven-configuration-reproducer/blob/4017887fed8bd9c7abd7174407be56531db912b0/child/pom.xml#L20-L25]
* However, child module also configures shade plugin inside a profile (adding 
an unrelated finalName parameter): 
[link|https://github.com/jhaber/maven-configuration-reproducer/blob/4017887fed8bd9c7abd7174407be56531db912b0/child/pom.xml#L41-L47]
* The nested-child module inherits from child module. It doesn't contain any 
configuration, but it activates the profile: 
[link|https://github.com/jhaber/maven-configuration-reproducer/tree/main/child/nested-child]
 

It is expected that child and nested-child do not inherit the outputFile 
parameter, because the shade configuration is removed in child pom.xml. This 
works in Maven 3.8.7, but in Maven 3.9.0 the nested-child module does inherit 
the outputFile parameter. I assume this has something to do with the profile 
getting activated and causing the configuration to not get merged properly, but 
I'm not sure.

I also built a custom version of Maven 3.9.0 which uses plexus-utils 3.3.1, and 
the behavior is back to normal. So I think the behavior change is in 
plexus-utils (although it could be that Maven is "mis-using" plexus-utils, and 
the plexus-utils change is technically correct). I tested with a few different 
plexus-utils versions and it seems like the behavior change was introduced in 
plexus-utils 3.4.0.



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

Reply via email to