[
https://issues.apache.org/jira/browse/MRESOLVER-164?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17287381#comment-17287381
]
Tamás Cservenák edited comment on MRESOLVER-164 at 2/19/21, 9:49 PM:
---------------------------------------------------------------------
Ayes, hacked in a switch similar to
https://github.com/apache/maven/compare/master...cstamas:ignore-pom-repositories
flag, but even dirtier, just using a system property:
https://github.com/apache/maven/compare/master...cstamas:MRESOLVER-164-hack
Command line is like this executed as Xiang Li explains above (added junit to
demo-snippets):
{noformat}
rm -r /tmp/repo1/junit/;
~/bin/apache-maven/apache-maven-4.0.0-alpha-1-SNAPSHOT/bin/mvn
-Dmaven.repo.local=/tmp/repo1 clean install -Dtest=void -Drat.skip
-DfailIfNoTests=false -f
maven-resolver-demos/maven-resolver-demo-snippets/pom.xml -DversionFilter=false
{noformat}
Obviously, {{-DversionFilter=false}} makes it work "like master is", while
{{-DversionFilter=true}} enables the hack.
Build with {{-DversionFilter=false}}:
https://gist.github.com/cstamas/9d4c5b928e7aa3d251692b41792d20aa
Build with {{-DversionFilter=true}}:
https://gist.github.com/cstamas/91017fa5f1bf07005da78812a1e43602
HUGE
was (Author: cstamas):
Ayes, hacked in a switch similar to
https://github.com/apache/maven/compare/master...cstamas:ignore-pom-repositories
flag, but even dirtier, just using a system property:
https://github.com/apache/maven/compare/master...cstamas:MRESOLVER-164-hack
Command line is like this:
{noformat}
rm -r /tmp/repo1/junit/;
~/bin/apache-maven/apache-maven-4.0.0-alpha-1-SNAPSHOT/bin/mvn
-Dmaven.repo.local=/tmp/repo1 clean install -Dtest=void -Drat.skip
-DfailIfNoTests=false -f
maven-resolver-demos/maven-resolver-demo-snippets/pom.xml -DversionFilter=false
{noformat}
Obviously, {{-DversionFilter=false}} makes it work "like master is", while
{{-DversionFilter=true}} enables the hack.
Build with {{-DversionFilter=false}}:
https://gist.github.com/cstamas/9d4c5b928e7aa3d251692b41792d20aa
Build with {{-DversionFilter=true}}:
https://gist.github.com/cstamas/91017fa5f1bf07005da78812a1e43602
HUGE
> 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)