How to automatically download dependencies when installing plugin

plugins

(Can Wang) #1

Hi there,

I am really new to gradle, and I am developing a gradle plugin which is published to gradle plugin portal with gradle’s plugin-publish-plugin. In my plugin, I created a task, which would execute some jar files. And the required jar files are available on maven center, which means that these jar files are the dependencies of this plugin. I want gradle to automatically pull these jar files from maven center when installing my plugin.

I searched around the internet but found nothing I could reference. Is there any documents, resources, or examples I could reference?

Any idea will be appreciated! Thanks a lot!


(Stefan Oehme) #2

Do I understand correctly that your plugin wants to run a tool which it downloads from a Maven repo when needed?

You can use a detached configuration and resolve it inside your plugin to get some dependencies you need for running a tool. See ConfigurationContainer and DependencyHandler.