Dependency Insight for Multi-project Builds

(Jared Stewart) #1

Is there an easy way to execute the dependencyInsight task for all projects in my multi-project build?

For example, say I have :core, :test, :web modules and I would like to see the version of spring-core used by each of them. Is there any way to do this without defining a new task that will run dependencyInsight on each of the subprojects?

(Mark Vieira) #2

This is difficult to do via the command line as you can only run the report per-project. You can however very easily get this information from a Build Scan.

(Marcin Zajączkowski) #3

It can simply achieved with a little trick I broadly described in my blog post some time ago.

It is just required to add:

subprojects {    
    task allDepInsight(type: DependencyInsightReportTask) << {}

to your project build configuration and call (for example):

gradle allDepInsight --configuration testRuntime --dependency org.slf4j:slf4j-simple

The task is automatically executed for all subprojects.

The same can be done for just displaying all dependencies in all subprojects - see this post.

Update: Just after sending my answer I spotted the last sentence in the original question… Please note however, If you don’t want to modify your project configuration the init script could be probably used instead.