'How to write a JsonDependencyReportTask for gradle?

Gradle has a built-in DependencyReportTask which will output the dependencies as an ASCII tree.

I see it has a setRenderer method, how can I pass in a custom JsonRenderer to it and generate a JSON format of the dependencies?

I also found there is a HtmlDependencyReportTask, but still can't get the idea of how to do it



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source