Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there Gradle "dependencies " task for buildScript dependencies?

Tags:

java

gradle

One can run gradlew dependencies to learn about dependencies of module tasks. It there a way to find transitive dependencies of buildscript dependencies?

Example: classpath 'com.android.tools.build:gradle:1.0.0' depends directly on:

com.android.tools.build builder com.android.tools.lint lint net.sf.proguard proguard-gradle tools.base project-test-lib 

As can be seen on MVNRepository. But this artifacts have their own dependencies. Is there and way to find those out without manually traversing whole dependency tree?

As a clarification, the classpath I'm talking about is defined by:

buildscript {     repositories {}     dependencies { .... } } 
like image 329
atok Avatar asked Jan 05 '15 12:01

atok


People also ask

What is Buildscript in Gradle?

buildscript: This block is used to configure the repositories and dependencies for Gradle. Note: Don't include dependencies here. ( those will be included in the module-level build.gradle) dependencies: This block in buildscript is used to configure dependencies that the Gradle needs to build during the project. Java.

Does Gradle handle transitive dependencies?

Transitive dependencyBy default, Gradle resolves transitive dependencies automatically. The version selection for transitive dependencies can be influenced by declaring dependency constraints.

How do I sync Gradle with dependencies?

Simply open the gradle tab (can be located on the right) and right-click on the parent in the list (should be called "Android"), then select "Refresh dependencies". This should resolve your issue.


2 Answers

Unfortunately there is no way to specify the build script configuration to the implicit dependencies task via the CLI. You'll have to explicitly define a task of type DependencyReportTask configured with your build script configuration.

task buildscriptDependencies(type: DependencyReportTask) {     configurations = [buildscript.configurations.classpath] } 

Update:

Beginning with Gradle 2.10 you can now get information on buildscript dependencies via

gradle buildEnvironment 
like image 169
Mark Vieira Avatar answered Sep 24 '22 04:09

Mark Vieira


I think you're looking for Gradle's DependencyInsightReportTask

like image 33
Mark Avatar answered Sep 20 '22 04:09

Mark