October 26, 2010

Gradle has plugins to provide functionality in a modularized way. One of the basic plugins is the base plugin. This plugin is not part of the public API of Gradle, so the functionality can change. In this post we look at what functionality the base plugin provides for Gradle version 0.9-rc1.

When we apply the base plugin to our project we get a couple of tasks we can use:

assemble

task that builds all archives of the project.

clean

task that deletes the build directory.

We get two configurations:

archives

configuration for archives.

default

extends archives configuration.

For each configuration we get a build and upload task:

buildArchives and buildDefault

builds all artifacts for the configuration.

uploadArchives and uploadDefault

upload artifacts for the configuration.

And we get a task rule clean<taskname> that is capable of cleaning the ouput files of any task we create in our project.

Also the following properties are added to the project:

distDirName

directory to store archives created by the project.

libsDirName

directory to store JAR files created by the project.

archivesBaseName

base name for archives.

In the following sample we define a project with the base plugin and use the tasks, configurations and properties that are added by the plugin: