Chapter 22. Standard Gradle plugins

There are a number of plugins included in the Gradle distribution. These are listed below.

22.1. Language plugins

These plugins add support for various languages which can be compiled and executed in the JVM.

Table 22.1. Language plugins

Plugin Id Automatically applies Works with Description
java java-base -

Adds Java compilation, testing and bundling capabilities to a project. It serves as the basis for many of the other Gradle plugins. See also Chapter 7, Java Quickstart.

groovy java, groovy-base -

Adds support for building Groovy projects. See also Chapter 9, Groovy Quickstart.

scala java, scala-base -

Adds support for building Scala projects.

antlr java -

Adds support for generating parsers using Antlr.

22.2. Experimental language plugins

These experimental plugins add support for various languages:

Table 22.2. Language plugins

Plugin Id Automatically applies Works with Description
cpp - -

Adds C++ source compilation capabilities to a project.

cpp-exe cpp -

Adds C++ executable compilation and linking capabilities to a project.

cpp-lib cpp -

Adds C++ library compilation and linking capabilities to a project.

22.3. Integration plugins

These plugins provide some integration with various build and runtime technologies.

Table 22.3. Integration plugins

Plugin Id Automatically applies Works with Description
announce - -

Publish messages to your favourite platforms, such as Twitter or Growl.

application java -

Adds tasks for running and bundling a project as application.

build-announcements announce -

Sends local announcements to your desktop about interesting events in the build lifecycle.

ear - java

Adds support for building J2EE applications.

jetty war -

Deploys your web application to a Jetty web container embedded in the build. See also Chapter 10, Web Application Quickstart.

maven - java, war

Adds support for deploying artifacts to Maven repositories.

osgi java-base java

Adds support for building OSGi bundles.

war java -

Adds support for assembling web application WAR files. See also Chapter 10, Web Application Quickstart.

22.4. Software development plugins

These plugins provide help with your software development process.

Table 22.4. Software development plugins

Plugin Id Automatically applies Works with Description
checkstyle java-base -

Performs quality checks on your project's Java source files using Checkstyle and generates reports from these checks.

codenarc groovy-base -

Performs quality checks on your project's Groovy source files using CodeNarc and generates reports from these checks.

eclipse - java, groovy, scala

Generates files that are used by Eclipse IDE, thus making it possible to import the project into Eclipse. See also Chapter 7, Java Quickstart.

eclipse-wtp - ear, war

Does the same as the eclipse plugin plus generates eclipse WTP (Web Tools Platform) configuration files. After importing to eclipse your war/ear projects should be configured to work with WTP. See also Chapter 7, Java Quickstart.

findbugs java-base -

Performs quality checks on your project's Java source files using FindBugs and generates reports from these checks.

idea - java

Generates files that are used by Intellij IDEA IDE, thus making it possible to import the project into IDEA.

jdepend java-base -

Performs quality checks on your project's source files using JDepend and generates reports from these checks.

pmd java-base -

Performs quality checks on your project's Java source files using PMD and generates reports from these checks.

project-report reporting-base -

Generates reports containing useful information about your Gradle build.

signing base -

Adds the ability to digitally sign built files and artifacts.

sonar - -

Provides integration with the Sonar code quality platform.

22.5. Base plugins

These plugins form the basic building blocks which the other plugins are assembled from. They are available for you to use in your build files, and are listed here for completeness. However, be aware that they are not yet considered part of Gradle's public API. As such, these plugins are not documented in the user guide. You might refer to their API documentation to learn more about them.

Table 22.5. Base plugins

Plugin Id Description
base

Adds the standard lifecycle tasks and configures reasonable defaults for the archive tasks:

  • adds buildConfigurationName tasks. Those tasks assemble the artifacts belonging to the specified configuration.
  • adds uploadConfigurationName tasks. Those tasks assemble and upload the artifacts belonging to the specified configuration.
  • configures reasonable default values for all archive tasks (e.g. tasks that inherit from AbstractArchiveTask). For example, the archive tasks are tasks of types: Jar, Tar, Zip. Specifically, destinationDir, baseName and version properties of the archive tasks are preconfigured with defaults. This is extremely useful because it drives consistency across projects; the consistency regarding naming conventions of archives and their location after the build completed.

java-base

Adds the source sets concept to the project. Does not add any particular source sets.

groovy-base

Adds the Groovy source sets concept to the project.

scala-base

Adds the Scala source sets concept to the project.

reporting-base

Adds some shared convention properties to the project, relating to report generation.

22.6. Third party plugins

You can find a list of external plugins on the wiki.