Apply gradle custom jar plugin

The chapter 58 of the user guide has all the information you need. In summary:

  • Put your myPlugin.properties inside your project structure, in src/main/resources/META-INF /gradle-plugins/
  • Build your jar like you usually do
  • In the script you wish to use this plugin, add a buildscript closure to something like:

    buildscript {
        repositories {
            flatDir dirs: "build/libs"
        }
        dependencies {
            classpath "your.group:your-plugin:1.0.0"
        }
    }
    

Or whatever settings for repositories and dependencies you wish, but you need to use the classpath configuration as I've done here. I don't think you can (or should!) add the jar to the plugin dir of Gradle like you did.

Note: the flatDir does not resolve transitive dependencies. The same rule for dependency management applies to the buildscript, so you can use a regular maven or ivy repository to deploy your plugin.