Mister
(Jake P)
April 7, 2015, 3:37pm
1
This is an extension to GRADLE-2945.
The bug is fixed as described, i.e. the following works:
dependencies {
runtime (group: ‘com.foo’, name: ‘library’, version: ‘1.0.0’, ext: ‘zip’) { exclude group: ‘*’ }
}
What I want is to specify the dependency as-is, but without the exclusion, and to inject the exclusion at the configuration level from the parent project (so that no transitive dependencies are applied to the pom for any dependency)
So the new code becomes:
configurations {
runtime.exclude group: ‘*’
}
dependencies {
runtime (group: ‘com.foo’, name: ‘library’, version: ‘1.0.0’, ext: ‘zip’)
}
Based on the documentation:
Adds an exclude rule to exclude transitive dependencies for all dependencies of this configuration.
I would expect the behaviour to be consistent with the module-level exclusion.
You can disable transitive dependencies at the configuration level like so.
configurations {
runtime {
transitive = false
}
}
Mister
(Jake P)
April 8, 2015, 8:15am
3
I tried your suggestion, but it was also not honored by the maven-publish plugin.
The result I am looking for is for the following to be present inside the pom for each dependency:
<exclusions>
<exclusion>
<artifactId>*</artifactId>
<groupId>*</groupId>
</exclusion>
</exclusions>
So far, the only way to do this is by explicitly specifying the exclude at the module level:
dependencies {
runtime (group: 'com.foo', name: 'library', version: '1.0.0', ext: 'zip') {
exclude group: '*'
}
}
I can’t find any way of injecting this behaviour from the parent project.
Ok, this is dealing specifically with POM generation, understood. I’ve raised GRADLE-3274 to track this.