Developing a Gradle plugin
· 8 min read
I've recently been learning how to write a Gradle plugin
and want to document my insights.
Types of Plugins
There are three ways to implement a Gradle
plugin: Script plugins
, Precompiled script plugins
, and Binary plugins
.
Script plugins
: The plugin logic is implemented directly in thebuild.gradle
file and can only be used in the current build.Precompiled script plugins
: The plugin logic is implemented in a separate file (either.gradle
or.gradle.kts
) within the project and can be used across multiple builds in the project.Binary plugins
: The plugin logic is implemented in a standalone project and packaged as a JAR file, which can be referenced and used in other projects by including the JAR file.
In this article, we'll create a Binary plugin
using a separate project.