I think you need to ignore project module dependencies here when building up this list.  If I have a multi-module project, I just want to list the dependencies of my dependencies, not the modules I depend on because Gradle has no way to declare what license the module has.