You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Tamas Cservenak (Jira)" <ji...@apache.org> on 2023/10/30 10:39:00 UTC

[jira] [Updated] (MRESOLVER-391) Scope mediation improvements

     [ https://issues.apache.org/jira/browse/MRESOLVER-391?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Tamas Cservenak updated MRESOLVER-391:
--------------------------------------
    Description: 
Original issue description was: "As per MNG-5988: if an artifact in "test" scope is found nearer, but in scope "compile" is found deeper in graph, the "test" scope wins. This at runtime may lead to CNFEx."

This is completely wrong premise, and it contains following false assumptions:
* "test" classpath is superset of "runtime" classpath
* (derived from that above) to get "runtime" classpath collect via resolver "test" classpath and cherrty-pick (or filter out) "test" scoped nodes
* a collected graph can contain both, "test" and "runtime" classpath (implied with "test scope wins but at runtime...")

When one asks resolver to collect (or resolve), resolver will perform based on input. And the result is either this or that, but not both. In fact, the collected "dirty tree" (graph) cannot even represent both "test" or "runtime" at the same time!

The reproducers in this issue are actually precise examples showing why it is impossible.

Hence, this issue should be more like a "discussion" to decide what is right behavior of resolver in these cases, as for sure there are some edge cases (like silent version bump from 1.x to 2.x), but still, it does happen per user instruction (who authors POM), and Resolver does not want to delve into "compatibility calculation" space, where it can decide is a change "compatible" or not (like semver and alike).

  was:As per MNG-5988: if an artifact in "test" scope is found nearer, but in scope "compile" is found deeper in graph, the "test" scope wins. This at runtime may lead to CNFEx.


> Scope mediation improvements
> ----------------------------
>
>                 Key: MRESOLVER-391
>                 URL: https://issues.apache.org/jira/browse/MRESOLVER-391
>             Project: Maven Resolver
>          Issue Type: Bug
>          Components: Resolver
>            Reporter: Tamas Cservenak
>            Priority: Major
>             Fix For: 2.0.0
>
>
> Original issue description was: "As per MNG-5988: if an artifact in "test" scope is found nearer, but in scope "compile" is found deeper in graph, the "test" scope wins. This at runtime may lead to CNFEx."
> This is completely wrong premise, and it contains following false assumptions:
> * "test" classpath is superset of "runtime" classpath
> * (derived from that above) to get "runtime" classpath collect via resolver "test" classpath and cherrty-pick (or filter out) "test" scoped nodes
> * a collected graph can contain both, "test" and "runtime" classpath (implied with "test scope wins but at runtime...")
> When one asks resolver to collect (or resolve), resolver will perform based on input. And the result is either this or that, but not both. In fact, the collected "dirty tree" (graph) cannot even represent both "test" or "runtime" at the same time!
> The reproducers in this issue are actually precise examples showing why it is impossible.
> Hence, this issue should be more like a "discussion" to decide what is right behavior of resolver in these cases, as for sure there are some edge cases (like silent version bump from 1.x to 2.x), but still, it does happen per user instruction (who authors POM), and Resolver does not want to delve into "compatibility calculation" space, where it can decide is a change "compatible" or not (like semver and alike).



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