Gradle Release Notes

Version 0.8

  1. New and Noteworthy
  2. Migrating from 0.7
  3. Credits
  4. Fixed Jira Issues

New and Noteworthy

Gradle GUI

Gradle now ships with a GUI, which you can use to explore and run builds. To try it out, run gradle --gui.

For more details, see the user guide

Scala support

Gradle can now build Scala projects. This works the same way as Java and Groovy projects: Simply usePlugin 'scala' and add your Scala source to src/main/scala and src/test/scala. Then, running gradle build will compile, test and JAR your project. As always, source locations, Scala versions, and so on, are completely configurable.

The Scala plugin supports joint compilation of Scala and Java source, for projects which have Java classes which use Scala classes and vice versa. You can mix any combintation of Java, Groovy and Scala source in your project.

For more details, see the user guide

Checkstyle support

Checkstyle is supported for projects with Java source. Simply usePlugin 'code-quality' and add your Checkstyle configuration file at config/checkstyle/checkstyle.xml. Gradle will take care of running Checkstyle on all your production and test source as part of the build task.

For more details, see the user guide

CodeNarc support

CodeNarc is supported for projects with Groovy source. Simply usePlugin 'code-quality' and add your CodeNarc configuration file at config/codenarc/codenarc.xml. Gradle will run CodeNarc on all your production and test source as part of the build task.

For more details, see the user guide

More flexible project layouts

With the introduction of source sets to the Java plugin, Gradle can now handle many different project layouts very conveniently. You can easily add or change the source directories of the project in very flexible ways. Want your source files and resources in the same directory? No problem. Want all the projects to share the same source directory? Production and test source in the same location? Multiple source directories? All easily done.

Source sets let you easily add additional logical groups of source code, with their own compile and runtime classpaths. You can use this to, for example, add an integration test suite with its own compile and runtime classpaths is easy. Or separate source files which are to be compiled using different Java versions. Or as an alternative to the buildSrc project to contain classes used in your build.

Source sets are available for Java, Groovy and Scala projects.

For more details, see the user guide

Improvements to the Java project lifecycle

Three tasks have been added to the Java plugin:

For more details, see the user guide

Initialization script support

You can use an initialization script to configure and change pretty much any aspect of Gradle you like. All of the APIs available in the build script are available in the initialization script.

For more details, see the user guide

Improved command-line

You can exclude a task from executing, by using the -x command-line option with the name of the task to exclude. Dependencies of the excluded task are also excluded, unless they are required by another task.

You no longer need to provide a complete task name on the command-line. You can provide the first few characters of the task name, and, provided this unambigously identifies the task, Gradle will figure out what you mean. You can also use camel case abbreviations for task names, like you can in an IDE. For example, you can type gradle exDB instead of gradle explodedDistBase. Gradle will also give you some suggestions if you make a typo in the task name.

Finally, we have improved error reporting. The error messages are better laid-out, and Gradle will give you some suggestions about where to go next to resolve the problem. These suggestions are pretty basic at the moment, but will improve over subsequent releases.

For more details, see the user guide

Improved support for file handling

Gradle provides new powerful domain objects to work with the file system. You can define file collections and file trees, add them, visit their elements and apply filters. You can copy them around and many other tasks/domain objects take them as input.

For more details, see the user guide

Writing custom tasks is now easier

Custom tasks no longer need a special constructor. Also, we've added a tutorial chapter to the user guide which describes how to implement a custom task.

For more details, see the user guide

Performance improvements

There have been a number of performance improvements on Gradle 0.8. Dependency resolution is faster, building Groovy projects is much faster, Gradle startup and project evaluation is faster.

Migrating from 0.7

Gradle 0.8 Breaking Changes


Many thanks to Mike and John Murph from Automated Logic for the fantastic Gradle UI and other contributions. Many thanks to Ross Black for the excellent Scala Plugin. A special thanks to Tomek Kaczanowski for all his work around the Gradle documentation. Thanks for their Jira's/patches/feedback to Andrei Sereda, Carlton Joseph, Daniel Mueller, Hamlet D'Arcy, Jacob Grydholt, Jiri Mares, Jon Cox, Levi Hoogenberg, Marc Guillemot, Martin Vlcek, Peter L., Philip Crotwell.

Fixed Jira Issues

0.8 Breaking Changes


Java Plugin Tasks

The jar task no longer depends on the test task. In multiproject builds, the tests in depended on projects will not be required to run in order to build up the artifacts.

Three new tasks have been added:

See the "Multi-Project Building and Testing" section of the userguide for more information.

The compileTests task has been renamed to compileTestJava. A new testClasses task has been added which is a replacement for compileTests.

The compile task has been renamed to compileJava. A new classes task has been added which is a replacement for compile.

The libs and dists tasks have been merged into a single assemble task.

Groovy Plugin Tasks

The compile task has been split into compileJava and compileGroovy. The compileJava task uses javac to compile all the Java source in src/main/java. The compileGroovy task uses groovyc to compile all the Groovy and Java source in src/main/groovy.

A similar change has been made to the compileTests task. It has been split into compileTestJava and compileTestGroovy.

Command-line options

Command-line option \-f has been renamed to \-S.
Command-line option \-I now specifies an init script. You can use \--no-imports instead.

Build Scripts

The build property has been renamed gradle.

Main classes are now compiled into $buildDir/classes/main
Test classes are now compiled into $buildDir/classes/test

Use of FileSet is deprecated. Use Project.fileTree() instead.

Skip properties no longer supported

Skip properties for tasks are no longer supported. This means you can no longer use -Dskip.someTask to skip a task. Instead, you can exclude individual tasks using the \-x command line option:

gradle \-xtest \-xdocs build

You can add skip properties support to your build script if you like, using the following:

tasks.allTasks { task ->
    task.onlyIf { System.getProperty("skip.${}") != null }

Java convention property changes

Many of the properties used to configure the locations of resource and Java source have changed. Below are some examples:

0.7 0.8
srcDirsNames << 'somedir' 'src/somedir'
floatingSrcDirs << file('somedir') file('somedir')
resourceDirs sourceSets.main.resources.srcDirs
resourceDirsNames << 'somedir' sourceSets.main.resources.srcDir 'src/somedir'
floatingResourceDirs << file('somedir') sourceSets.main.resources.srcDir file('somedir')
testSrcDirNames << 'somedir' 'src/somedir'
floatingTestSrcDirs << file('somedir') file('somedir')
testResourceDirs sourceSets.test.resources.srcDirs
testResourceDirNames << 'somedir' sourceSets.test.resoures.srcDir 'src/somedir'
floatingTestResourceDirs << file('somedir') sourceSets.test.resources.srcDir file('somedir')
classesDir sourceSets.main.classesDir
classesDirName = 'somedir' sourceSets.main.classesDir = 'build/somedir'
testClassesDir sourceSets.test.classesDir
testClassesDirName = 'somedir' sourceSets.test.classesDir = 'build/somedir'
srcRootName = 'somedir' removed
srcRoot removed
javadocsDir javadoc.destinationDir
javadocsDirName = 'somedir' javadoc.destinationDir = file('build/docs/somedir')

Groovy convention property changes

Many of the properties used to configure the locations of Groovy source have changed. Below are some examples:

0.7 0.8
groovySrcDirs sourceSets.main.groovy.srcDirs
groovySrcDirNames << 'somedir' sourceSets.main.groovy.srcDir 'src/somedir'
floatingGroovySrcDirs << file('somedir') sourceSets.main.groovy.srcDir file('somedir')
groovyTestSrcDirs sourceSets.test.groovy.srcDirs
groovyTestSrcDirNames << 'somedir' sourceSets.test.groovy.srcDir 'src/somedir'
floatingGroovyTestSrcDirs << file('somedir') sourceSets.test.groovy.srcDir file('somedir')
groovydocDir groovydoc.destinationDir
groovydocDirName = 'somedir' groovydoc.destinationDir = file("$docsDir/somedir")

War convention property changes

webAppDirName = 'somedir' webAppDirName = 'src/somedir'

Java project configuration changes

The testCompile configuration no longer includes the main classes directory. You can use source.test.compileClasspath instead of configurations.testCompile to pick up the full test compile classpath.

You can also add the main classes directory back into the testCompile configuration:

dependencies {
    testCompile sourceSets.main.classes

The Java plugin no longer adds a dists configuration.

Archive tasks

jar { files 'a', 'b' } jar { from 'a', 'b' }

Compile task

* The srcDirs property has been replaced by the src property. You can pass this method any of the types supported by Project.files(). ||0.7||0.8||
0.7 0.8
compile.srcDirs = [new File('src1'), new File('src2')] compileJava.source = ['src1', 'src2']
* Compiler args are set differently now:
0.7 0.8
compile.options.compilerArgs = [[value: '-Xlint'], [value: 'othervalue']] compile.options.compilerArgs = ['-Xlint', 'othervalue']

GroovyCompile task

0.7 0.8

compile {
    srcDirs = [new File('src1')]
    groovySrcDirs = [new File('src2')]
    groovyJavaIncludes = ['**/Included*.java']
    groovyIncludes = ['**/Included*.groovy']
compileGroovy {
    source 'src1', 'src2'
    include '**/Included*.java'
    include '**/Included*.groovy'

Javadoc task

* The srcdirs property has been replaced by the src property. * The excludes property now takes a set of Ant-style exclude patterns, rather than package names. * The configuration property has been renamed to classpath. * The sourcepath, subpackages and packagenames properties have been removed. They have been replaced by include and exclude properties.

Groovydoc task

* The srcDirs property has been replaced by the src} property. * The packageNames property has been replaced by the include property.

Test task

* The configuation property has been renamed to classpath.

JettyRun task

* The classesDirectory and configuration property of the JettyRun task have merged into a single classpath property.


The Build class has been renamed to Gradle. The Gradle class has been renamed to GradleLauncher. Project.getBuild() has been renamed to Project.getGradle(). BuildListener.buildStarted() now accepts a Gradle parameter, rather than a StartParameters parameter. The following interfaces have been moved to org.gradle.api.file package: The LogLevel.log() methods have been replaced by the Logger interface, accessible from Logging.getLogger(). CopyActionImpl.globalExcludes has moved to PatternSet.