# Gradle 2.5 and above ignoring excluded dependencies in genereated ivy.xml

**URL:** <https://discuss.gradle.org/t/gradle-2-5-and-above-ignoring-excluded-dependencies-in-genereated-ivy-xml/15038>\
**Category:** Bugs\
**Tags:** issue-acknowledged, gradle-3440\
**Created:** [March 8, 2016, 7:06pm UTC](https://discuss.gradle.org/t/gradle-2-5-and-above-ignoring-excluded-dependencies-in-genereated-ivy-xml/15038 "2016-03-08T19:06:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mkornipati](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@mkornipati](https://discuss.gradle.org/u/mkornipati)\
**Post date:** [March 8, 2016, 7:06pm UTC](https://discuss.gradle.org/t/gradle-2-5-and-above-ignoring-excluded-dependencies-in-genereated-ivy-xml/15038/1 "2016-03-08T19:06:58Z")

</div>

We are in process of upgrading Gradle 2.4 to 2.5 and came across this issue.

Our projects got few dependencies with excluding some transitives like below

> compile (“org.drools:drools-core:6.3.0.Final”){  
> exclude group : ‘org.mvel’  
> }  
> compile (“org.springframework:spring-core:4.2.5.RELEASE”){  
> exclude group : ‘commons-logging’  
> }

When we run `uploadArchives`, it is generating ivy.xml with entries as

```
    <dependency org="org.drools" name="drools-core" rev="6.3.0.Final" conf="compile-&gt;default"/>
     <dependency org="org.springframework" name="spring-core" rev="4.2.5.RELEASE" conf="compile-&gt;default"/>

But when we ran the same with Gradle 2.4, it shows as

  <dependency org="org.drools" name="drools-core" rev="6.3.0.Final" conf="compile-&gt;default">
       <exclude org="org.mvel" module="*" name="*" type="*" ext="*" conf="compile" matcher="exact"/>
     </dependency>
     <dependency org="org.springframework" name="spring-core" rev="4.2.5.RELEASE" conf="compile-&gt;default">
       <exclude org="commons-logging" module="*" name="*" type="*" ext="*" conf="compile" matcher="exact"/>
     </dependency>

```

I tried running even with gradle 2.11 and I still the same behavior. Is this intentional?

Attaching sample project to reproduce the issue [Gradle-ivy-Test.zip](https://discuss.gradle.org/uploads/short-url/sHohJ7gA7tfNpznlIv2Wx6uN4zd.zip) (59.9 KB)

Just try running

“Gradle uploadArchives” with Gradle 2.4 and 2.5, and should see the difference…

---

<div class="post-metadata">

**Author:** ![Eike](https://avatars.discourse-cdn.com/v4/letter/e/e19b73/32.png) [@Eike](https://discuss.gradle.org/u/Eike)\
**Post date:** [March 21, 2016, 8:30am UTC](https://discuss.gradle.org/t/gradle-2-5-and-above-ignoring-excluded-dependencies-in-genereated-ivy-xml/15038/2 "2016-03-21T08:30:28Z")

</div>

I did some debugging on your example and found the place in the gradle code, where the exclude rules get lost:

The class org.gradle.internal.component.external.model.DefaultIvyModulePublishMetaData has a method addDependency which converts a org.gradle.internal.component.model.DependencyMetaData to a org.apache.ivy.core.module.descriptor.DefaultDependencyDescriptor. Both data structures have attributes which model the exclude rules. However the method does not transfer them, so they get lost. Looking at the git history of the file it does not seem to be an intended change in the behaviour. So I guess it is a bug.

---

<div class="post-metadata">

**Author:** ![bmuschko](https://sea1.discourse-cdn.com/gradle/user_avatar/discuss.gradle.org/bmuschko/32/5458_2.png) [@bmuschko](https://discuss.gradle.org/u/bmuschko)\
**Post date:** [April 18, 2016, 8:31pm UTC](https://discuss.gradle.org/t/gradle-2-5-and-above-ignoring-excluded-dependencies-in-genereated-ivy-xml/15038/3 "2016-04-18T20:31:12Z")

</div>

Thanks for reporting. This looks like a bug. I was able to reproduce the issue and opened the following issue: GRADLE-3440

---

<div class="post-metadata">

**Author:** ![mkornipati](https://avatars.discourse-cdn.com/v4/letter/m/f05b48/32.png) [@mkornipati](https://discuss.gradle.org/u/mkornipati)\
**Post date:** [April 19, 2016, 3:01pm UTC](https://discuss.gradle.org/t/gradle-2-5-and-above-ignoring-excluded-dependencies-in-genereated-ivy-xml/15038/4 "2016-04-19T15:01:12Z")

</div>

Thanks @bmuschko for creating GRADLE-3440
