Can anyone tell me if it’s possible to exclude geronimo-javamail without having to explicitly declare each sub dependency? For example, I think I have to do this:
Does a ‘dependencies’ task on gradle command line should reflect these exclusions specified per dependency ? Seem that (at least as I’ve tested on Gradle v1.8) exclude() method does not work on transitive dependencies of second and more in deep levels… Is it a bug ?
Note that I’ve also tried to use the configuration closure with exclude method immediately after the compile configuration in dependencies section with the same effect - dependencies task output shows ‘stax:stax’ artifact(which is on third transitive level ONLY), but hides ‘org.springframework’ artifacts (which EXIST on the first transitive level).
I hoped that when I specify the transitive dependency in exclude method by using group and module attributes (as they appeared in the dependency tree output of dependencies task) - the dependency should disappear in the subsequent dependencies task tree output for the original/top level/ dependency, but that’s not a case and that nested transitive dependency still exists in dependencies tree output(with the same group and module) and in the resulting war file… Is that a bug ? Does anybody else (except me and topic starter) run into such behavior ?
I’ve found some more or less workaround for this problem, e.g. for above mentioned approach (when all dependencies defined in one place - libraries.gradle) - you can use the following code snippet to force exclude the nested transitive dependency from ALL grouped first level dependencies (despite of present this nested dependency in the particular top level dependency sub-tree or not - as dependencies task output shows):