The binary plugin

Binary plugins are classes that implement the Plugin interface, which you can embed into the build script. Alternatively, you can create a separate project, package it into a jar file and add that jar file as a classpath entry to a project. The second approach makes it more reusable. Each binary plugin has one ID to uniquely identify it. To use a binary plugin, you need to include it using the apply plugin statement:

apply plugin: '<pluginid>'

For example, to use the Java plugin, you can write the following code:

apply plugin: 'java'

You can also use the class type to add plugins. For example, if you are creating a custom class, DisplayPlugin, as a plugin, you can apply the following code:

apply plugin: DisplayPlugin

Before using ...

Get Mastering Gradle now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.