gaurav414u
gaurav414u

Reputation: 821

How to add multiple Jars to be excluded from Gradle Build

I am using the following segment in build.gradle to exclude a jar from my build process:

compile fileTree(dir: 'libs', exclude: 'androidannotations-api-2.7.1.jar' , include: '*.jar')

Can anyone please tell me how can I exclude 1 more jar using this command ? i.e I have to exclude multiple jars from the build process.

Upvotes: 3

Views: 8774

Answers (1)

Scott Barta
Scott Barta

Reputation: 80020

This syntax should work:

compile fileTree(dir: 'libs', excludes: ['androidannotations-api-2.7.1.jar', 'foo.jar', 'bar.jar'], include: '*.jar')

You can see an example of it in the Gradle docs at http://www.gradle.org/docs/current/userguide/working_with_files.html where they show the difference between include: and includes: and also show some path globbing. Those docs don't explicitly state that excludes: is supported, but if you dig into the DSL references at http://www.gradle.org/docs/current/javadoc/org/gradle/api/file/ConfigurableFileTree.html you can see a setExcludes method.

Upvotes: 18

Related Questions