Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I view the dependency tree for Gradle's buildSrc?

Tags:

gradle

I can normally view a dependency tree for a project by running ./gradlew dependencies, but I cannot figure out how to view the dependency tree for the Gradle buildSrc directory.

I have tried accessing it as a sub project, ./gradlew buildSrc:dependencies but that does not work.

build.gradle (for buildSrc)

repositories { mavenCentral() }
dependencies {
    testCompile 'org.mockito:mockito-core:1.10.19'
    testCompile 'junit:junit:4.12'
}
like image 277
Mike Rylander Avatar asked Sep 28 '16 20:09

Mike Rylander


People also ask

How do you read a Gradle dependency tree?

The dependency tree in a build scan renders the selection reason (conflict resolution) as well as the origin of a dependency if you click on a dependency and select the "Required By" tab. Every Gradle project provides the task dependencyInsight to render the so-called dependency insight report from the command line.

Where are dependencies stored in Gradle?

Defined dependencies will be loaded from remote repositories into gradle's local repository folder. For each loaded file, gradle will be create a new folder named with md5 value of the original file (pom,jar,..).


1 Answers

Consider the following (the only way that I know of):

$ cd buildSrc
$ gradle dependencies

Note, given your build.gradle example, that buildSrc is its own project in Gradle and needs a proper file. Your example doesn't declare any plugins. Assuming you are using Java, a fix is:

apply plugin: 'java'

repositories { 
    mavenCentral() 
}

dependencies {
    testCompile 'org.mockito:mockito-core:1.10.19'
    testCompile 'junit:junit:4.12'
}
like image 183
Michael Easter Avatar answered Sep 19 '22 21:09

Michael Easter