The first plugin

To make the plugin reusable for all the other projects, Gradle allows you to separate the plugin code and package it in a JAR file. You can include this JAR file in any projects in which you want to reuse this functionality. You can create the standalone project in Java or Groovy. We will proceed with Groovy. You can use any editor (Eclipse, NetBeans, or Idea) to create a plugin. Since our main purpose is to show you how to create a standalone plugin, we will not go into the details of the editor. We will use a simple text editor. To proceed with the standalone plugin, separate the above buildSrc code into an independent directory. You can name it CustomPlugin. So, the directory structure will be as follows:

C:/Gradle/Chapter8/CustomPlugin. ...

Get Gradle Essentials 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.