Cannot exclude module from build.gradle

I am trying to exclude some modules from my build.gradle file, but it (code1 and code2) still loads 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 to use the following code,

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

it excludes files, but I do not want to use this method to exclude files

+8
java build.gradle gradle
source share
1 answer

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

What can happen is that you have some other (maybe non-aws) dependency that can transitively use aws-java-sdk , which then leads to a machine learning dependency. That is why it works great when you execute a global exception, but not when you execute a local exception only on aws-java-sdk .

Try running gradlew dependencies --configuration=compile to get the dependency tree, including the transition tree, to check what dependency aws-java-sdk-machinelearning can make

+2
source share

All Articles