Application plugin distZip includes excluded transitive dependencies (Gradle 2.2)

I used the application plugin for the first time, and observed that an excluded transitive dependency was included in the lib directory of the zip file created by the distZip task. Excluding via a compile dependency declaration should be enough:

compile('') {
        exclude module: 'my-dependent-jar-to-exclude'

I also tried other mechanisms for excluding the file:

configurations {
        all*.exclude group: '', module: 'my-dependent-jar-to-exclude'
    applicationDistribution.exclude("**/my-dependent-jar-to-exclude.jar", "/lib/my-dependent-jar-to-exclude.jar","my-dependent-jar-to-exclude.jar")

my-dependent-jar-to-exclude.jar remains obstinately present in the lib directory of the distributions zip file created by the distZip task.

Any clues for me?

I got it to work by including the wildcard for the version in the applicationDistribution pattern. Still not sure why the transitive dependency exclusion did not work, but this work-around fixed it:


(I had to include part of the version number in the pattern because other dependencies matched the pattern without it)