
- Before you can publish your plugin code to mavenLocal(), you have to add add the ‘maven-publish’ to your plugin build.gradle.
plugins {
id 'java-gradle-plugin'
id 'maven-publish'
...
}
- Then publish you artifacts to mavenLocal()
$ gradlew publishToMavenLocal
- In your application code add mavenLocal() to the pluginManagement of your settings.gradle file.
pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
}
}
- Now you can reach your plugin in your application build.gradle from maven local repository :)
plugins {
id '<myplugin-id>' version '<myplugin-version>'
}
A Working example on github
- Example Plugin
- Example Application Code
$ git clone https://github.com/elmolm/gradle-playground.git
$ cd extended-java-library-plugin
$ gradlew publishToMavenLocal
$ cd ../mavenlocal-plugin-resolve
$ gradlew check