I am trying to write a gradle script where i want to ignore or exclude certain modules or groups from a jar file.
My Code :
dependencies {
compile fileTree(dir: "$buildDir/native-libs", include: 'native-libs.jar')
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/test.jar')
}
So , from test.jar file i want to exclude 'com.xyz.abc' , but i don't find how do i write the script.
Please let me know , suggest me some good solution.
Try excluding transitive dependencies as described here:
You can exclude a transitive dependency either by configuration or by dependency:
Example 52.14. Excluding transitive dependencies
build.gradle
configurations {
compile.exclude module: 'commons'
all*.exclude group: 'org.gradle.test.excludes', module: 'reports'
}
dependencies {
compile("org.gradle.test.excludes:api:1.0") {
exclude module: 'shared'
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With