Using exclude:* excludes the primary dependency

I want to exclude all transitive dependencies of a jar I’m adding to my project. I’m adding a dependency like this:

compile(group:‘corp_dependencies’, name: ‘my.commons.rest’, version: ‘latest.integration’, configuration:‘compile’)

{

exclude module:’*’

}

It appears that this excludes not only the transitive dependencies, but the direct dependency as well (my.commons.rest). Is this a feature or a bug, or am I just doing something fundamentally wrong?

A better way to achieve what you want would be:

compile(group:'corp_dependencies', name: 'my.commons.rest', version: 'latest.integration', configuration:'compile') {
  transitive = false
}