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

Hervé Guillemet commented on MNG-7563:
--------------------------------------

Beside breaking some existing builds, which may be necessary if it's about 
fixing a bug, I'd say the trouble is about encapsulation:

When your project use a dependency, this dependency bringing a whole tree of 
dependencies, you are not meant to know which properties are used by all these 
dependencies for their internal needs (like the resolution of their own 
dependencies).

So you may break dependencies unintentionally by setting a property for your 
own project.

You may argue here that it's the responsability of the developer of the 
dependency to use some prefix in the name of the properties to mimic namespaces 
and avoid clashes.

But more generally is it a desired feature to be able to alter dependencies of 
dependencies using properties ?

It's already possible with profiles and that didn't change with 3.8.5.

 

 

> Java system properties now override user properties in dependencies
> -------------------------------------------------------------------
>
>                 Key: MNG-7563
>                 URL: https://issues.apache.org/jira/browse/MNG-7563
>             Project: Maven
>          Issue Type: Bug
>          Components: Dependencies, POM
>    Affects Versions: 3.8.5, 3.8.6
>            Reporter: Hervé Guillemet
>            Assignee: Michael Osipov
>            Priority: Major
>             Fix For: waiting-for-feedback
>
>         Attachments: poms.zip
>
>
> An important change has been introduced in 3.8.5 that breaks some existing 
> builds: Java system properties now take precedence over default values of 
> user properties in dependency POMs. This look like a bug since it's now easy 
> to affect dependency behaviors with system properties, a practice that has 
> been discouraged. But maybe do you consider this as a new feature ?
> As an example, 3 poms are attached to this ticket.
> After installing projects b and c, building project a with:
> {{mvn package -Ddep=x}}
> used to succeed until 3.8.4 (-D is ignored) but throws error with 3.8.5 and 
> 3.8.6 (-D override the default).
> Note that without the setting of the default value for property {{dep}} in 
> project b, the build fails with any version of Maven.



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

Reply via email to