Generation of ivy descriptors with excluded transitive dependencies

Continuing the discussion from Cannot get gradle to publish a module with dependency exclusions to Ivy:

I am facing the same issue. I checked the gradle source code. Obviously the GenerateIvyDescriptor task does not support generating excludes. I think this would be a useful feature request.

Are you using the Ivy Publishing plugin?

Yes, I am using the ivy publishing plugin. As I needed this feature quickly, I have created a patch. For me the patch seems to work fine. I have created a pull request.

Great, thanks for sending the pull request. That’ll certainly help moving the topic forward. At the moment we are a bit swamped but we’ll try to review your pull request asap.

Do you have a timeline for the integration of the pull request by Eike? Our product development is struggling with this issue. For now we will try to solve this with editing of ivy descriptor, but it is very hard to maintain.

Looks like this PR merged in 2.11 but I see this is not working? Please refer my new discussion topic - Gradle 2.5 and above ignoring excluded dependencies in genereated ivy.xml

Hi Mohaan, I had a look at the example you have posted in the referenced post. I could reproduce the behavior. Nevertheless it does not seem to be related to this PR.

Gradle has (at least) two different ways of publishing to ivy. This PR was related to the ‘ivy-publish’ plugin(https://docs.gradle.org/current/userguide/publishing_ivy.html). Your example uses the ‘uploadArchives’ task which is another way of doing publishing in gradle.

So for me it looks like that the ‘uploadArchives’ way introduced a bug which removes the exclude rules in gradle 2.5 while the ‘ivy-publish’ plugin did not support the excludes in older versions but supports it since gradle 2.11.

So you could consider migrating to the ‘ivy-publish’ plugin and upgrade to the latest gradle version or you need to wait for a bugfix in the old mechanism and continue using gradle 2.4.