19

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.

Matthias Kricke
  • 4,931
  • 4
  • 29
  • 43
  • 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
  • 2
    Is 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 Answers4

17

I would recommend the license-gradle-plugin. It can report on licenses from your dependencies via the downloadLicense task.

Justin Ryan
  • 2,413
  • 1
  • 15
  • 5
7

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.

Stevi Deter
  • 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
2

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.

Stan
  • 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
1

You can also try the https://github.com/mikepenz/AboutLibraries It covers the Kotlin Multiplatform as well. Actually it covers any gradle type projects.

Atiar Talukdar
  • 668
  • 11
  • 22