Gradle Transitive dependency exclusion is not working as expected. (How do I get rid of com.google.guava:guava-jdk5:13.0 ?)

前端 未结 5 1055
星月不相逢
星月不相逢 2020-12-30 01:57

here is a snippet of my build.gradle:

compile \'com.google.api-client:google-api-client:1.19.0\'
compile \'com.google.apis:google-api-services-oauth2:v2-rev7         


        
5条回答
  •  盖世英雄少女心
    2020-12-30 02:12

    I met several causes of this strange behavior of gradle dependencies:

    • it turned out that Gradle 4.10.x caches some interim results in its daemon, so just running the command might not be up to date. Thus, disable the Gradle daemon.
    • there are other tools and IDEs (Eclipse,etc.) that can run the Gradle daemon for their own integration and project build. Thus, check for other daemon processes and kill them
    • there seems to be some additional caching even with disabled daemon, therefore run gradle clean dependencies instead
    • consider setting environment variable GRADLE_OPTS=-Dorg.gradle.daemon=false -Dorg.gradle.caching=false to avoid the caching or provide these options in the command line
    • the dependencies report itself is deceptive as it may not show (neither indicate) the next occurrences of the same the unwanted dependency, reached through other paths. Then excluding the transitive the unwanted dependency from the first path does not work and still shows it on that path, no matter that it came through another (invisible) path.

    Identify all paths the the unwanted dependency is reached through and exclude it from all of them.

    Comment out the first path / dependency run gradle clean dependencies to find the next path the dependency is reached through. Repeat until all such paths found. Then uncomment and exclude the unwanted dependency from all paths identified.

提交回复
热议问题