我正在尝试编写一个 gradle 脚本,我想在其中忽略或排除 jar 文件中的某些模块或组。
我的代码:
dependencies {
compile fileTree(dir: "$buildDir/native-libs", include: 'native-libs.jar')
compile fileTree(dir: 'libs', include: ['*.jar'])
compile files('libs/test.jar')
}
所以,我想从 test.jar 文件中排除“com.xyz.abc”,但我找不到如何编写脚本。
请让我知道,建议我一些好的解决方案。
最佳答案
按照here所述尝试排除传递依赖:
您可以通过配置或依赖排除传递依赖:
示例 52.14。排除传递依赖
构建.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'
}
}
关于android - 如何从 Gradle 中排除 jar 中的模块或组?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33671005/