New ivy-publishing plugin does not take into account global dependency exclusions

not-a-bug

(Jarek Lewandowski) #1

When using global (per configuration) exclusion of certain dependencies, this is not reflected in produced ivy.xml descriptior file. The legacy method using uploadArchives task does this part correctly. Bellow is a sample project showing the problem

group = 'test'
version = '1.0'

apply plugin: 'java'
apply plugin: 'ivy-publish'

repositories {
    jcenter()
}

publishing {
  publications {
    ivy(IvyPublication) {
      from components.java
    }
  }
  repositories {
    ivy {
      url "file://${buildDir}/repo"
    }
  }
}

configurations.all {
  exclude group: 'commons-logging', module: 'commons-logging'
}

dependencies {
  compile "org.springframework:spring-core:4.2.6.RELEASE"
}

It’s expected for the above file to produce ivy.xml with the following entry for every configuration published in section.

<exclude org="commons-logging" module="commons-logging" artifact="*" type="*" ext="*" conf="<CONFNAME>" matcher="exact"/>

where will be replaced with a proper conf. name

Gradle Version: 3.0
Operating System and JVM version: OSX 10.11.6, JVM v,1.8.0_65-b17
Is this a regression? no, it looks like it never workded, tested on gradle 2.9 with the same result

Sample project: https://github.com/jotel/gradle-ivy-publish-issue


(Stefan Wolf) #2

Hi Jared,

even local exclusions have not been included in the generated ivy xml. Gradle 3.1 will have a fix for that. See also GRADLE-3440. Could you check if your problem is fixed with the latest Gradle nightly.

Cheers,
Stefan


(Jarek Lewandowski) #3

Hi Stefan,

the GRADLE-3440 refers to uploadArchives task which uses different method… the problem I’ve described is for new (well… it’s how it is referred in documentation anyway :wink: ivy-publishing plugin which uses a PublishingExtension… The problem still exists in the latest Gradle nightly build. There is no problem though with exclusion at the particular dependency level e.g.

dependencies {
  compile "org.springframework:spring-core:4.2.6.RELEASE", {
    exclude group: 'commons-logging'
  }
}

which works from version 2.14 of Gradle.

Regards
Jarek


(Stefan Wolf) #4

Hi Jarek,

you are completely right. We will probably not start working on this feature soon. We would be happy if you could provide a pull request, though.

Regards,
Stefan