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?
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.
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.
No, dependencies and dependencyInsight tasks are designed to be called on one specific project.
If you really need that and cannot use a build scan, you need an approach similar to what Marcin posted, just with a bit less bad-practices. (not using task(...), not using subprojects { ... }, not using << {}, …