Neither StrictConflictManager nor LatestCompatibleConflictManager appear
to respect the 'force="true" attribute value on dependency. We would
like to have the behavior of StrictConflictManager with the enhancement
that it would recognize the dependency force attribute as an override to
strict conflict resolution. This appears to be fairly easy to code by
extending StrictConflictManager something like this:

 

public class StrictPlusForceConflictManager extends
StrictConflictManager {

 

    @Override

    public Collection resolveConflicts(IvyNode parent, Collection
conflicts) {

        /*

         * Before using algorithm of StrictConflictManager,

         * first check for "force" revision  using code from
LatestConflictManager.

         */

        if (conflicts.size() < 2) {

            return conflicts;

        }

        for (Iterator iter = conflicts.iterator(); iter.hasNext();) {

            IvyNode node = (IvyNode) iter.next();

            DependencyDescriptor dd =
node.getDependencyDescriptor(parent);

            if (dd != null && dd.isForce()

                    &&
parent.getResolvedId().equals(dd.getParentRevisionId())) {

                return Collections.singleton(node);

            }

        }

        return super.resolveConflicts(parent, conflicts);

    }

}

 

We have not yet tested because it is a non-trivial task to create our
own ConflictManager subclass, configure to ivy, and deploy the compiled
class into an appropriate classpath for our build process. For now we
are working around this issue by using a strategy based on the
dependency exclude attribute. However, this strategy is not as clean for
us as it would be to use the dependency force attribute.

 

Is it possible that combined strict/force conflict management support
could be added to Ivy? Or maybe someone can suggest a strategy to
achieve something similar using support already provided?

 

Thanks,

 

Greg Burcher



Reply via email to