Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 874
r123 Avatar asked Mar 06 '26 11:03

r123


1 Answers

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

like image 153
RaGe Avatar answered Mar 09 '26 00:03

RaGe



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!