variables (and where they are used)

Writing a gradle plugin that works and that can be tested easily requires a few bits of knowledge to make the process seamless.

For your reference, the variables that are required on the command line are the smallest subset of variables that you will need to generate the file. You will most likely be required to update some of the files to ensure that you create and publish your plugin correctly.

{artefact}

The artefact variable is

{name} and {lowerName}

The name variable is used throughout most of the files - this is also translated to lowerName by lowercasing the first letter of the {name} variable. (i.e. String lowerName = name.substring(0,1).toLowerCase() + name.substring(1);)

These variables are used in the following files::

  • {artefact}.{lowerName}.properties file
    • The {lowername} variable used to generate the file name
    • The {name} variable is used as a value for the implementation-class key in the properties file

{desc}

This variable is used in the following files:

  • build.plugin.initial.gradle file
    • The {desc} variable is used as the description property
    • The {name} variable is used as a value for the implementation-class key in the properties file

So, we created this scaffolding generator for gradle plugins in java!

This project also provides the documentation, so that you understand what is going on and are able to extend the plugin to do whatever you want it to. Rather than building yet another plugin (which we wanted to), we decided to build this plugin builder - as a way of sharing the knowledge of how to build plugins, and as a final test - use it as a way to build the next plugin!