How to execute 'dependencyInsight' on (some) subprojects?

In a multiproject scenario, it could be useful having way to execute the dependencyInsight task on the root, some subprojects or all of them. Is there any way to achieve it?

Moreover it could be useful to specify more than a --dependency switch value (hence searching for more than one dependency). Is it feasible?

You can use task paths rather than task names to control which tasks get executed, but I’m not sure if you can have different command-line arguments per task. (Perhaps it’s possible with ‘gradle task1 taskOptions1 task2 taskOptions2’, etc.) I don’t think you can have multiple ‘–dependency’ options for one and the same task, but one value may match multiple dependencies (e.g. ‘foo’ will match ‘foo-one’ and ‘foo-two’).

If you’re already using gradle 1.9, you can use the new htmlDependencyReport task. It will generate an HTML dependency report, and a click on a dependency will open a popup showing the insight for this dependency.

I confirm calling

gradle -q prj1:dependencyInsight --dependency “foodep” prj2:dependencyInsight --dependency “foodep” works and while passing multiple –dependency options per single task fail complaining Multiple arguments were provided for command-line option ‘–dependency’.

Wouldn’t it be good having a way to specify multiple option values and execute dependencyInsight on every project of a multiproject? i.e.

gradle -q “*:dependencyInsight” --dependency “foodep” --dependency “bardep”

yeah, it works… even if having a way to show only the dependencies you need would make things easier

I would love to be able to specify multiple projects in this way. If my project pulls in dependency x, I don’t necessarily know which subproject pulled it in. This would help. Right now running this on the root project I just get:

Configuration with name ‘compile’ not found.

which makes sense since the root project is just a holder for the subprojects – it doesn’t have its own source.