简体   繁体   中英

How Do We Run a Gradle Dependency Report for Plugins?

Running gradle dependencies lists compile-time dependencies. IOW, it reports direct and transitive dependencies coming from the dependencies closure for the subproject.

What is the equivalent means of determining the transitive dependencies being used by Gradle plugins, the ones specified by the dependencies closure in the buildscript closure?

For example, suppose I have this top-level build.gradle file in an Android project:

buildscript {
    repositories {
        jcenter()
        maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.3.1'
        classpath 'com.apollographql.apollo:gradle-plugin:0.3.1-SNAPSHOT'
    }
}

allprojects {
    repositories {
        jcenter()
        maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
    }
}

How do I find out what transitive dependencies are being pulled in by the com.apollographql.apollo:gradle-plugin:0.3.1-SNAPSHOT dependency?

Gradle provides various help tasks. A list of them is available via gradle tasks -all .

To access the buildscript dependencies, one can use the gradle buildEnvironment command, as described in the Gradle docs :

4.7.5. Listing project buildscript dependencies

Running gradle buildEnvironment visualises the buildscript dependencies of the selected project, similarly to how gradle dependencies visualises the dependencies of the software being built.

As addition, CommonsWare stated, that the command must be executed from the project directory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM