[ https://issues.apache.org/jira/browse/MRESOLVER-256?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Michael Osipov closed MRESOLVER-256. ------------------------------------ Resolution: Fixed Fixed with [2ea36519a72079b9efa59c6278b15bfb01a53fb4|https://gitbox.apache.org/repos/asf?p=maven-resolver.git&a=commit&h=2ea36519a72079b9efa59c6278b15bfb01a53fb4]. > Dependency tree is different between DF and BF strategies when a dependency > package has no indirect dependencies > ---------------------------------------------------------------------------------------------------------------- > > Key: MRESOLVER-256 > URL: https://issues.apache.org/jira/browse/MRESOLVER-256 > Project: Maven Resolver > Issue Type: Bug > Components: Resolver > Affects Versions: 1.8.0 > Reporter: Michael Osipov > Assignee: Michael Osipov > Priority: Major > Fix For: 1.8.1 > > > From GitHub: > Fix the problem that the dependency tree is different when DF and BF > strategies are adopted when a dependency package has no children dependency. > When BF is adopted, when a dependent package has no children dependency, it > will not continue to call the doRecurse() method, that is, it will not call > the CacheManager.cachewinner() to put this dependency package into the > winnerGAs object, which affects the analysis results of dependency packages > of the same GA. The current fix is to call the CacheManager.cachewinner() > method when a dependent package has no children dependency and it is not skip > resolution, so that the dependent package can be found in winnerGAs. > We take the dependency in the following figure as an example to illustrate > the generation process of the problem. > <img width="359" alt="image" > src="https://user-images.githubusercontent.com/104960983/166911972-6d721f62-ea17-46fc-af60-181aa5fdb041.png"> > At org eclipse. aether. internal. impl. Bfdependencycollector > #collectdependencies() mainly has two stages: processdependency() and > transformer.transformGraph( node, context )。 > In the first stage of process dependency: > 1. When parsing to D1, descriptorResult.getDependencies().isEmpty(), so > doRecurse() will not be executed. Therefore, args.skipper.cache() will not be > executed. The D1 will not exist in winnerGAs in the end. >  > 2. When parsing D2 of the same layer, because there is no same GA in > winnerGAs, D2 and its children dependencies ( G1 and H1) will be parsed. > 3. When resolving to G2 on the same layer as G1, because winnerGAs already > has G1, the resolution of the children dependencies of G2 will be skipped, > that is, H2 will not be resolved. > Then, to the second stage, transformgraph: > 4. Because D1 has the same depth as D2, D1 wins, that is, D2 and its children > are eliminated, including G1 > 5. Because G1 was eliminated, G2 won. > Finally, the final dependency tree obtained by BF strategy is as follows: > <img width="272" alt="image" > src="https://user-images.githubusercontent.com/104960983/166912027-21d7fcd4-79bd-43cc-80c8-0088091a91ef.png"> > But the dependency tree obtained by DF is as follows: > <img width="296" alt="image" > src="https://user-images.githubusercontent.com/104960983/166912045-2cff5bd6-f54d-4faa-a955-6c985923058a.png"> > That is, in the final generated dependency tree, BF has less children > dependency of G2 than DF. -- This message was sent by Atlassian Jira (v8.20.7#820007)