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

Didier Loiseau commented on MNG-8190:
-------------------------------------

{quote}The first problem is that the resolver is used before building the main 
model when downloading Maven extensions.
{quote}
Based on some debugging, I think a new {{RepositorySystemSession}} gets 
instantiated after extensions have been resolved. I think it would be 
acceptable to use the new behavior for extensions, and then switch back when 
detecting an old pom. The problem, however, is that the new instance is created 
before calling {{{}DefaultProjectBuilder.build(){}}}, and in 
{{{}DefaultProjectBuilder.BuildSession#build(){}}}, it seems there is some 
dependency resolution happening already in some cases, right after the model is 
built – and it does not seem to be a very good place to switch.
{quote}The second problem is that we could have mixed modelVersions and I don't 
think we can change during the resolution (afaik). We could assume a fixed 
value and look at the root project's modelVersion I suppose.
{quote}
I think it would make sense to take the root’s modelVersion indeed – this 
behavior could be documented. I suppose projects shouldn’t be partially 
migrated anyway.
{quote}Also this would work only when building projects. When consuming, the 
intent of the developer would not be followed, as this would mean each 
dependency should be resolved differently.
{quote}
Indeed, but this is already an issue today with Maven 4… AND with Maven 3, 
since a library developer may already think that their 
{{<dependencyManagement>}} will apply to end-users when it actually does not. 
The same workarounds will remain needed if the library is intended to be used 
by Maven 3 dependents.
{quote}So I'm not saying we can't, but I'm not really sure that it will 
actually lessen the disruption.
{quote}
Most projects shouldn’t have mixed modelVersions, and I think we can assume 
that extensions will run the same as before. For me the important thing is that 
the resulting artifact should have the same dependencies if it’s still in 
modelVersion 4.0.0 – especially for war/ear/fatjar/docker images which bundle 
them.

When users switch to modelVersion 4.1.0, they can fix their dependency 
management if the new resolution does not satisfy them.

Personally, I’m fine with the new behavior and I think most projects will not 
be affected at all. For those that are affected, they would typically get newer 
versions of their transitive dependencies, as requested by the intermediate 
dependencies, which seems to be a good thing.

In the worst case though, it could be that they get an older or incompatible 
version, and the consequences are difficult to predict.

I’m thus worried about potential backlash, as [it happened for this exact 
reason in Maven 
3.4|https://lists.apache.org/thread/c0p0dsrwb45zm974vn95pdvy3gnfs8ox] almost 8 
years ago. Of course the context is different since this is a major release, 
and I don’t know what’s allowed. But from my understanding, this is the only 
(potentially) breaking change, isn’t it?

> Restrict build pom feature to 4.1.0 model version
> -------------------------------------------------
>
>                 Key: MNG-8190
>                 URL: https://issues.apache.org/jira/browse/MNG-8190
>             Project: Maven
>          Issue Type: New Feature
>          Components: Core
>    Affects Versions: 4.0.0-beta-3
>            Reporter: Karl Heinz Marbaise
>            Assignee: Guillaume Nodet
>            Priority: Major
>             Fix For: 4.0.0-beta-5
>
>
> Currently I can omit the version tag in a parent definition (or dependency) 
> in a module with ModelVersion:4.0.0 which is not correct.
> This should fail with an appropriate failure message even in Maven 4.0.0+ 
> We should allow omitting the version tag (parent) in a module only for Maven 
> 4+ with the ModelVersion 4.1.0 



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

Reply via email to