r123
r123

Reputation: 618

Cannot exclude module from build.gradle

I'm trying to exclude some modules from my build.gradle file but it(code1 and code2) still downloads the excluded files.

code 1:

compile (group: 'com.amazonaws', name: 'aws-java-sdk', version: '1.11.7') {
  exclude group: 'com.amazonaws', module: 'aws-java-sdk-machinelearning'
}

code 2:

  compile (group: 'com.amazonaws', name: 'aws-java-sdk', version: '1.11.7') {
      exclude module: 'aws-java-sdk-machinelearning'
    }

when I tried using the following code,

    configurations {
compile.exclude module: 'aws-java-sdk-machinelearning'
}

it excludes the files but I don't want to use this method to exclude files

Upvotes: 3

Views: 1267

Answers (1)

RaGe
RaGe

Reputation: 23677

I second/confirm with @Opal that code1 works fine in Gradle 2.13.

What is likely happening is that you have some other (maybe non-aws) dependency, that may be transitively using aws-java-sdk which then brings in the machine-learning dependency. Which is why, it works fine when you do a global exclude, but not when you do a local exclude on just aws-java-sdk.

Try running gradlew dependencies --configuration=compile to get a tree of dependencies, including transitives, to check which dependency might be bringing in aws-java-sdk-machinelearning

Upvotes: 2

Related Questions