I want to list all maven dependencies (including transitive ones) of my gradle build with their licenses. Is this possible with the IntelliJ gradle plugin? If yes, how? Alternatively a gradle command line instruction would be sufficient, too.
-
No idea if license info is stored in gradle. You probably need to dig into source code or do some debugging. – Opal Jun 18 '14 at 08:23
-
Not in gradle but in maven. The projects includes maven dependencies with gradle. – Matthias Kricke Jun 18 '14 at 08:29
-
Yes, I understood. But You need to display the data using gradle, yes? – Opal Jun 18 '14 at 08:31
-
Yes, because the dependencies are set in the build.gradle file. I want the process to take every dependency, search for all transitive dependencies, and list all of them including their licenses. In worst case it would be enough to only see all dependencies and search the licenses by hand. – Matthias Kricke Jun 18 '14 at 08:33
-
2Is running `gradle dependencies` what You are looking for? – Opal Jun 18 '14 at 08:34
-
Ah, didn't used gradle yet via command line. The list of dependencies helps very much. Still, the licenses are missing. Maybe their is a parameter to show them? – Matthias Kricke Jun 18 '14 at 08:50
-
No rather not. Will investigate this later, maybe will find a way to help. – Opal Jun 18 '14 at 08:52
-
I found a plugin that may help: https://github.com/hierynomus/license-gradle-plugin . One of its features states: "This plugin will also report on the licenses of your dependencies." – Matthias Kricke Jun 18 '14 at 08:54
-
Yes, should be what You're looking for. – Opal Jun 18 '14 at 08:55
4 Answers
I would recommend the license-gradle-plugin. It can report on licenses from your dependencies via the downloadLicense task.

- 2,413
- 1
- 15
- 5
-
2Yes, it's a great tool. Could you please extend your answer how to set the properties properly? I don't know where to do the following: downloadLicenses { includeProjectDependencies = true dependencyConfiguration = 'compile' } Should that be part of the build.gradle file? – Matthias Kricke Jun 19 '14 at 11:51
-
1Ok, found it myself. It has to be in the build.gradle. But I was not searching for compile but providedCompile :) – Matthias Kricke Jun 19 '14 at 12:29
-
3How to generate the report though? ./gradlew buildLicenses DOES NOT do anything for me – Shrikant Prabhu Dec 17 '19 at 22:35
-
2
-
-
For anybody who ends up here and discovered the license-gradle-plugin appears to be unmaintained, Gradle-License-Report works for this need as well.

- 1,653
- 12
- 16
-
This project seems to be maintained and the `license-gradle-plugin` doesn't seem to work for my 7.4 Gradle project, whereas `Gradle-License-Report` works fine. – Alan Cabrera Jul 10 '22 at 15:44
The only plugin that has worked for my Android project is Gradle License Plugin
https://github.com/jaredsburrows/gradle-license-plugin
The setup was quite simple - just one line in the project-level build.gradle and another line in the app-level build.gradle. My project is relatively complex, but doesn't have multiple modules btw.
P.S. I've also tried https://github.com/hierynomus/license-gradle-plugin and https://github.com/jk1/Gradle-License-Report with no success.

- 2,151
- 1
- 25
- 33
-
This was the only one working for me as well. Others generated empty files. I had some trouble setting up, but that was because I was applying the plugin in the project-level build.gradle, and apparently it doesn't work. – Aleksi Sjöberg Dec 17 '21 at 12:13
You can also try the https://github.com/mikepenz/AboutLibraries It covers the Kotlin Multiplatform as well. Actually it covers any gradle type projects.

- 668
- 11
- 22