How to extend the gradle plugin functionality? How to make reference to a external plugin from Myplugin.groovy?

If I try to use the following gradle plugin https://github.com/Transmode/gradle-docker and I create a new standalone plugin from there, implementing the new functionality into src/main/groovy/gradle/plugins/MyNewplugin.groovy I’m not able to make reference to it in order to load its functionality and extend it.

I tried different ways to do it, but it did not allow me to reach my goal.

E.g. :

I added “project.task(‘BuildDocker’,type: Docker)” into MyNewPlugin.groovy and I can build it “gradle build” but when this plugin is called from another place is not able to resolve the ‘Docker’ type. Any idea?

This question is likely better asked on the corresponding GitHub repository of the plugin.

BTW: Just a quick guess - did add an import statement to your build script for the Docker type?

Yeah, I did it but it didn’t work.

Assuming you want to extend an existing plugin, but creating a new plugin.

In this case you’ll need to add the Maven coordinates of the Transmode plugin to the implementation or compile configurations.

BTW there are a number of Docker plugins for Gradle. Have you looked at the others to see whether they are already providing thedunctionality you might need. There is also a Packer plugin which make light work of building Docker images.