Is there a way to include all licenses from all the third party dependencies in the distribution zip generated using 'buildPlugin' gradle task ?


Having all the third party dependencies from maven like org.json as given below

compile group: 'org.json', name: 'json', version: '20190722'

I am using buildPlugin gradle task to generate a installable zip for hosting in my custom plugin repository as mentioned here 

I wanted to include the copy of license of each of my dependency in the generated zip file. Like for the above mentioned org.json dependency the license file would be as specified in it's pom.xml

Currently the generated zip contains the following file structure, I would also like to include a folder "licenses" which contains all downloaded copies of licenses of each third-party jar

├── my-plugin
│   ├── licenses
│   │ └── json-20190722 // folder with jar name
│   │ └── LICENSE.txt // license file
│   └── lib
│   ├── annotations-13.0.jar
│   ├── json-20190722.jar
│   ├── kotlin-reflect-1.3.72.jar
│   ├── kotlin-stdlib-1.3.72.jar
│   ├── kotlin-stdlib-common-1.3.72.jar
│   ├── kotlin-stdlib-jdk7-1.3.72.jar
│   ├── kotlin-stdlib-jdk8-1.3.72.jar
│   ├── searchableOptions-0.7-SNAPSHOT.jar
│   └── my-plugin-1.0.0.jar

I could also write a Groovy task to download all the required files, But still need help on creating the licenses folder and moving file to the zip as given in the above file structure


It seems there are ready made solutions for this, e.g. first Google result


I guess I didn't make myself clear. I was able to generate the license list and download files too successfully. But wasn't able to figure out a way to include it in the zip file generated using the buildPlugin gradle task provided by org.jetbrains.intellij gradle plugin. 


buildPlugin is ZIP Task, so you can add contents to distribution like this (assuming /build/licenses contains all license information files/dirs)


Please sign in to leave a comment.