You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@maven.apache.org by "Xiang Li (Jira)" <ji...@apache.org> on 2021/02/19 19:40:00 UTC

[jira] [Comment Edited] (MRESOLVER-164) DefaultDependencyCollector filterVersions seems always return full version range

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

Xiang Li edited comment on MRESOLVER-164 at 2/19/21, 7:39 PM:
--------------------------------------------------------------

[~cstamas] Thanks for the reply, I did the same test which I basically add junit:[3.8.1, ] in this [pom|https://github.com/apache/maven-resolver/blob/maven-resolver-1.4.1/maven-resolver-demos/maven-resolver-demo-snippets/pom.xml] file and build the demo from `maven-resolver/maven-resolver-demos` and I have 

 
{code:java}
[INFO]
[INFO] -------< org.apache.maven.resolver:maven-resolver-demo-snippets >-------
[INFO] Building Maven Artifact Resolver Demo Snippets 1.4.1               [2/3]
[INFO] --------------------------------[ jar ]---------------------------------Downloading from apache.snapshots: https://repository.apache.org/snapshots/junit/junit/maven-metadata.xml
Downloading from maven-public/junit/junit/maven-metadata.xml
Downloaded from maven-public/junit/junit/maven-metadata.xml (1.4 kB at 433 B/s)
Downloading from maven-public/junit/junit/3.8.2-brew/junit-3.8.2-brew.pom
Downloaded from maven-public/junit/junit/3.8.2-brew/junit-3.8.2-brew.pom (187 B at 89 B/s)
Downloading from maven-public/junit/junit/4.0/junit-4.0.pom
Downloaded from maven-public/junit/junit/4.0/junit-4.0.pom (210 B at 1.4 kB/s)
Downloading from maven-public/junit/junit/4.1/junit-4.1.pom
Downloaded from maven-public/junit/junit/4.1/junit-4.1.pom (583 B at 404 B/s)
Downloading from maven-public/junit/junit/4.2/junit-4.2.pom
Downloaded from maven-public/junit/junit/4.2/junit-4.2.pom (931 B at 766 B/s)
Downloading from maven-public/junit/junit/4.3/junit-4.3.pom
....{code}
So do you think it might be some config issue if we have different behavior?

 


was (Author: xiangli1996):
[~cstamas] Thanks for the reply, when I hit that issue, I did the same test which I basically add junit:[3.8.1, ] in this [pom|https://github.com/apache/maven-resolver/blob/maven-resolver-1.4.1/maven-resolver-demos/maven-resolver-demo-snippets/pom.xml] file and build the demo from `maven-resolver/maven-resolver-demos` and I have 

 
{code:java}
[INFO]
[INFO] -------< org.apache.maven.resolver:maven-resolver-demo-snippets >-------
[INFO] Building Maven Artifact Resolver Demo Snippets 1.4.1               [2/3]
[INFO] --------------------------------[ jar ]---------------------------------Downloading from apache.snapshots: https://repository.apache.org/snapshots/junit/junit/maven-metadata.xml
Downloading from maven-public/junit/junit/maven-metadata.xml
Downloaded from maven-public/junit/junit/maven-metadata.xml (1.4 kB at 433 B/s)
Downloading from maven-public/junit/junit/3.8.2-brew/junit-3.8.2-brew.pom
Downloaded from maven-public/junit/junit/3.8.2-brew/junit-3.8.2-brew.pom (187 B at 89 B/s)
Downloading from maven-public/junit/junit/4.0/junit-4.0.pom
Downloaded from maven-public/junit/junit/4.0/junit-4.0.pom (210 B at 1.4 kB/s)
Downloading from maven-public/junit/junit/4.1/junit-4.1.pom
Downloaded from maven-public/junit/junit/4.1/junit-4.1.pom (583 B at 404 B/s)
Downloading from maven-public/junit/junit/4.2/junit-4.2.pom
Downloaded from maven-public/junit/junit/4.2/junit-4.2.pom (931 B at 766 B/s)
Downloading from maven-public/junit/junit/4.3/junit-4.3.pom
....{code}
So do you think it might be some config issue if we have different behavior?

 

> DefaultDependencyCollector filterVersions seems always return full version range
> --------------------------------------------------------------------------------
>
>                 Key: MRESOLVER-164
>                 URL: https://issues.apache.org/jira/browse/MRESOLVER-164
>             Project: Maven Resolver
>          Issue Type: Bug
>    Affects Versions: 1.4.2, 1.6.1
>            Reporter: Xiang Li
>            Priority: Major
>
> Related to MNG-7049 but I think the root cause is in maven-resolver so I opened a new issue. Correct me if it is better to still use the old ticket.
> During using version ranges, I notice that maven will download all poms from a version range, which happen in that [loop|https://github.com/apache/maven-resolver/blob/master/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/DefaultDependencyCollector.java#L404], the reason is that [verFilter|https://github.com/apache/maven-resolver/blob/master/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/DefaultDependencyCollector.java#L155] here seems return null. Since by default, versionFilter is set to null by DefaultRepositorySystemSession, and I do not see many examples that setVersionFilter get used for some reason. 
> Another thing that confuses me is that version range is resolved by DefaultVersionRangeResolver in maven rather than maven-resolver here.
>  
> I wonder if it possible to set HighestVersionFilter [here|https://github.com/apache/maven-resolver/blob/master/maven-resolver-impl/src/main/java/org/eclipse/aether/internal/impl/collect/DefaultDependencyCollector.java#L155] instead of return all version range results. I am happy to contribute a PR with some guidance.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)