我无法使用“排除”排除build.gradle文件中的番石榴模块。
有了这个依赖块:
dependencies { ... compile(group: 'com.google.api-client', name: 'google-api-client', version: '1.19.0') { exclude(group: 'com.google.guava', module: 'guava-jdk5') // !!! Doesn't work!!! ... } ... }我得到下面的依赖关系树。 请注意,不排除guava-jdk5。
+--- com.google.api-client:google-api-client:1.19.0 | +--- com.google.oauth-client:google-oauth-client:1.19.0 | | +--- com.google.http-client:google-http-client:1.19.0 | | | ... | | \--- com.google.code.findbugs:jsr305:1.3.9 | ... | \--- com.google.guava:guava-jdk5:13.0...
请注意,最后一行仍然包含番石榴模块,但它并未被排除。 为什么? 如何排除它?
I can't exclude a guava module in a build.gradle file using "exclude".
With this dependency block:
dependencies { ... compile(group: 'com.google.api-client', name: 'google-api-client', version: '1.19.0') { exclude(group: 'com.google.guava', module: 'guava-jdk5') // !!! Doesn't work!!! ... } ... }I get the dependency tree below. Note that guava-jdk5 is not excluded.
+--- com.google.api-client:google-api-client:1.19.0 | +--- com.google.oauth-client:google-oauth-client:1.19.0 | | +--- com.google.http-client:google-http-client:1.19.0 | | | ... | | \--- com.google.code.findbugs:jsr305:1.3.9 | ... | \--- com.google.guava:guava-jdk5:13.0...
Notice that the last line still includes the guava module, it has not been excluded. Why? How to exclude it?
最满意答案
问题在于另一个编译对象也依赖于具有guava-jdk5作为传递依赖项的第一级依赖项,所以这个其他对象引入了不需要的模块。
我终于可以看到这个使用
./gradlew -q :app:dependencyInsight --dependency guava --configuration compile并可以使用排除它
configurations { compile.exclude module: 'guava-jdk5' }The problem was that another compile object was also dependent on the first level dependency that had the guava-jdk5 as a transitive dependency, so this other object was bringing in the unwanted module.
I was able to finally see this using
./gradlew -q :app:dependencyInsight --dependency guava --configuration compileand could exclude it using
configurations { compile.exclude module: 'guava-jdk5' }更多推荐
发布评论