Book Image

Mastering Gradle

Book Image

Mastering Gradle

Overview of this book

Table of Contents (17 chapters)
Mastering Gradle
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

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 this approach make sure you import this class in the build file using the import statement. All the Gradle core plugins are available to you by default. You do not need any additional configuration to use them. For third-party or community...