[ https://issues.apache.org/jira/browse/IVY-1606?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Jaikiran Pai reassigned IVY-1606: --------------------------------- Assignee: (was: Jaikiran Pai) > incorrect dependency order on buildlist > --------------------------------------- > > Key: IVY-1606 > URL: https://issues.apache.org/jira/browse/IVY-1606 > Project: Ivy > Issue Type: Bug > Components: Core > Affects Versions: 2.5.0-rc1 > Reporter: Sven > Priority: Major > Labels: patch > Attachments: deps.png, example.zip > > Time Spent: 10m > Remaining Estimate: 0h > > Hi, > I am facing a problem with the ivy buildlist target: > My scenario looks like the graph in picture deps.png (see attachments). > The artefact 1B is having a dependency to A in Version 1.0. > The artefact C is having a dependency to A in Version 2.0 AND a dependency to > 1B (in Version 1.0). > In the ivy.xml file the conflict manager „latest-revision" is active. > Targets like report and resolve works like a charm, speaking Version 2.0 of > artefact A is pulled, while Version 1.0 is evicted. > But if I use the ivy:buildlist Tag, the dependency order looks like this: > > {code:java} > run: > [ivy:buildlist] :: Apache Ivy 2.5.0-RC1 - 20141213170938 :: > http://ant.apache.org/ivy/ :: > [ivy:buildlist] :: loading settings :: url = > jar:file:/C:/Program%20Files/apache-ant-1.10.1/lib/ivy-2.4.0.jar!/org/apache/ivy/core/settings/ivysettings.xml > [echo] ##### buildlist: test#1B, test#A1, test#A, test#D > > BUILD SUCCESSFUL > Total time: 0 seconds > {code} > > > As you can see, the dependency 1B is in first position, though it has an > (evicted) dependency to A. > After digging around in the source, I found the function > _getModuleDescriptorDependency_ in the Class _CollectionOfModulesToSort_ is > using a _VersionMatcher_ to determine the correct dependency order. > So this class do not take the conflict-manager „latest-revision" into > account. > I workaround this, by patching die SortEngine like so: > > {code:java} > 27d26 > < import org.apache.ivy.core.module.id.ModuleRevisionId; > 32d30 > < import org.apache.ivy.plugins.version.AbstractVersionMatcher; > 125,137c123 > < VersionMatcher matcher = new AbstractVersionMatcher("all") { > < > < @Override > < public boolean isDynamic(ModuleRevisionId askedMrid) { > < return false; > < } > < > < @Override > < public boolean accept(ModuleRevisionId askedMrid, > ModuleRevisionId foundMrid) { > < return true; > < } > < }; > < return matcher; > --- > > return settings.getVersionMatcher(); > {code} > > > After that, in my opinion the build order is correct, as the Version of a > dependency should not affect the dependency order: > {code:java} > run: > [ivy:buildlist] :: Apache Ivy 2.5.0-CL - 20190826123506 :: > http://ant.apache.org/ivy/ :: > [ivy:buildlist] :: loading settings :: url = > jar:file:/C:/Users/kuhnert/.ant/lib/ivy.jar!/org/apache/ivy/core/settings/ivysettings.xml > [echo] ##### buildlist: test#A1, test#A, test#1B, test#D > > BUILD SUCCESSFUL > {code} > > If you think, this is the right approach, I can create a merge request for > this ticket. > Otherwise, I would be glad to hear your thoughts. > > Kind regards, > Sven -- This message was sent by Atlassian Jira (v8.20.10#820010)