[GRADLE-2674] Gradle excludes all transitive dependencies when ivy.xml uses exclude on 'type' or 'conf' attributes Created: 07/Feb/13  Updated: 04/Dec/14  Resolved: 04/Dec/14

Status: Resolved
Project: Gradle
Affects Version/s: None
Fix Version/s: 2.3-rc-1

Type: Bug
Reporter: Gradle Forums Assignee: Benjamin Muschko
Resolution: Fixed Votes: 1


 Description   

Gradle 1.x is excluding all transitive dependencies whenever the dependency ivy.xml file has an exclude on other than group or module, for example:

<exclude type="foo" conf="bar"/>

org.gradle.api.internal.artifacts.ivyservice.resolveengine.ModuleVersionSpec.ExcludeRuleSpec.isSatisfiedBy(ModuleId) is always returning true when the above is present. The rule attributes look like this:

{module=*, artifact=*, matcher=exact, organisation=*, type=foo, ext=*}

. The mechanism used for rule matching only considers the module and organisation: org.apache.ivy.plugins.matcher.MatcherHelper.matches(PatternMatcher, ModuleId, ModuleId)



 Comments   
Comment by Gradle Forums [ 07/Feb/13 ]

Is this `[exclude]` element in the `[dependencies]` container element of ivy.xml, or nested inside a particular `[dependency]` element?

This does look like it might be a bug. Once you confirm the above question I'll raise in in Jira.

Would you be interested in helping out with a fix? This would involve:

  • creating some integration tests demonstrating the bug (infrastructure is already there)
  • fixing the actual bug, with consultation with Gradleware devs
  • submit a pull request with your changes

Supplying a fix is a pretty good way of expediting the resolution of this bug!

Comment by Gradle Forums [ 07/Feb/13 ]

The `exclude` element is inside a `dependencies` element.

I would be glad to help with the fix.

Comment by Justin Ryan [ 16/Oct/13 ]

Additional note, this also applies a artifact attribute exclude. We're running in the situation of having this:

<exclude artifact="netflix.content" org="netflix/>

Which results in every netflix module being skipped, because it resolves to a GroupNameSpec.

In subprojects/core-impl/src/main/groovy/org/gradle/api/internal/artifacts/ivyservice/resolveengine/ModuleVersionSpec.java when it's building Exclude specs, it throws away all extra info in rule.extraAttributes. Which sorta makes sense because the Exclude specs are only ever matched on a ModuleIdentifier (which only has a org and name). Even if the extra attributes (type, conf, artifact) are used in a spec, the framework only filters (with the specs) based on ModuleIdentifier. This is a pretty large change. At a minimum, and error or warning should be printed.

Generated at Wed Jun 30 12:28:22 CDT 2021 using Jira 8.4.2#804003-sha1:d21414fc212e3af190e92c2d2ac41299b89402cf.