Apply plugin from folder (instead of jar)


(Dieter K) #1

Hello,

for all my plugin development so far I did build a plugin.jar and pulished it to my local Maven repo or used a classpath files(’…/build/libs/MyPlugin-1.1.0.jar’) within buildscript{}.

  1. For my current plugin I would like to be able to not create a jar every time I change the plugin.
  2. I don’t want to (can’t) use the buildSrc approach

Basically all the plugin files wrapped in a jar (including META-INF/gradle-plugins/foo.MyPlugin.properties) are located in a folder. I would like to add that folder to the buildscript classpath instead of generating the jar and then call:
apply plugin: ‘foo.MyPlugin’

Is this possible? I did some initial tests but classpath(files(’…/folder’)) doesn’t seem to do it. Applying the plugin fails not being able to find my Plugin implementation class.


(Fred Curts) #2

classpath(files(’…/folder’)) should work as long as the path is correct and contains the plugin’s descriptor and class files (which can’t be produced by the same build). Same rules apply as for java -cp <folder> (e.g., the path’s dir structure must correspond to the package structure).