Skip to end of metadata
Go to start of metadata

Have a look at Gradle 0.9 Release Notes for more information about the new features in this release

Build Scripts

Updated to Groovy 1.7.3

Build scripts are now executed using Groovy 1.7.3. This should not cause any problems for most build scripts.

Using plugins

The usePlugin() method has been deprecated. Instead, you should use the apply() method.

0.8

0.9

Task action closures

The actions passed to Task.doFirst() and Task.doLast(), which includes those added using the << operator, now delegate to the task first, and then the owner of the closure. Previously, these closure would delegate to the owner first, then the project of the task. These changes make the behaviour of these closures consistent with the behaviour of other closures, such as task configuration closures.

For most cases, existing task action closures will continue to work unmodified. The following properties and methods will now refer to the task, rather than the project:

  • name
  • path
  • convention
  • hasProperty()
  • property()
  • setProperty()

Also, be aware that when you set a dynamic property in the task action closure, it will now set the property on the task, rather than the project.

0.8

0.9

Task onlyIf()

Each call to Task.onlyIf() now adds a predicate which must evaluate to true for the task to be executed. Previously, calling this method would replace any previously specified predicate. You can use Task.setOnlyIf() to get the old behaviour.

Project buildDirName

The Project.buildDirName property has been deprecated. It has been replaced by the buildDir property:

0.8

0.9

Tasks

Archive tasks

The Archive tasks now share a common API with the Copy task. This affects the Zip, Tar, Jar and War tasks.

  • The fileSet() method has been replaced with the from() method:

0.8

0.9

  • The zipFileSet() method has been replaced with the from() and into() methods. The equivalent of prefix, fileMode and dirMode are supported. There is no replacement for fullPath.

0.8

0.9

  • The tarFileSet() method has been replaced by the from() and into() methods, as for zipFileSet(). There are no replacements for userName, group, uid or gid.
  • The customName property has been merged into the archiveName property

0.8

0.9

  • The resourceCollections() method has been replaced by the from() method.

0.8

0.9

  • The merge() and mergeGroup() methods have been removed. You can use Project.zipTree() and Project.tarTree() to achieve the same thing:

0.8

0.9

  • The antDirective() method has been removed. There is no replacement.
  • The createIfEmpty, baseDir, resourceCollections, mergeFileSets and mergeGroupFileSets properties have been removed. There are no replacements.

Jar task

In addition to the changes listed above, the following changes have been made to the Jar task:

  • The metaInfResourceCollections property has been replaced by the metaInf() {...} method. This operates the same as if a call to into('META-INF') {...} was made:

0.8

0.9

War task

TBD

Copy task

  • A destination directory must be provided at the top level of the copy task. Previously, this was optional, provided the destination directory was specified in all nested copy specs.
  • The remapTarget method has been removed. You can use the rename method instead.
  • The parameter of the into method for a nested copy spec is now evaluated relative to the parent spec's destination directory.

Test task

  • The Test task now always executes the tests in a forked process.
  • The stopAtErrorsOrFailures property has been replaced by the ignoreFailures property.

JUnit Tests

  • The forkMode property has been replaced by a forkEvery property.

    0.8

    0.9

  • A number of properties have been moved from JUnitOptions to Test

    0.8

    0.9

  • Removed the filterTrace, fork, forkOptions, formatterOptions, outputToFormatters, printSummary, reloading, showOutput and tempDir properties from JUnitOptions.
  • Removed the cloneVm, newEnvironment and timeout properties from JUnitForkOptions.

    0.8

    0.9

TestNG Tests

  • A number of properties have moved from TestNGOptions to Test

    0.8

    0.9

  • The skippedProperty, dumpCommand, suiteRunnerClass properties have been removed from TestNGOptions.

Clean task

  • The Clean task has been replaced by the Delete task.

EclipseClean task

  • The EclipseClean task has been replaced by the Delete task.

Plugin Authoring

  • The Plugin interface has changed, so that it can target any time of object. The signature of Plugin.use() has also changed to reflect this:

0.8

0.9

  • A new instance of the plugin is created for each project. Previously, a single instance was created and shared by all projects. This allows you to keep per-project state in the plugin object itself.
  • The $GRADLE_HOME/plugin.properties file has been removed. Instead, you can add a resource called META-INF/gradle-plugins/$plugin-id.properties to your plugin JAR. This way, you can provide a name for your plugin without requiring the users of your plugin to do anything to their Gradle installation.

0.8

0.9

$GRADLE_HOME/plugin.properties
myplugin.jar!META-INF/gradle-plugins/myplugin.properties

Wrapper

  • A Gradle wrapper generated by Gradle 0.8 and earlier will no longer work with Gradle 0.9

Other Changes

  • The l, -K, -no-imports command-line options have been removed.
  • The JDK 1.4 compatible distribution is no longer available.
  • The default-imports file is no longer available in the Gradle distribution.

API Changes

  • org.gradle.api.TaskAction and org.gradle.api.ProjectAction have been replaced by org.gradle.api.Action.
  • Settings and Gradle methods disableStandardOutputCapture(), captureStandardOutput() and getLogger() have been removed. You can use the replacements on org.gradle.api.Script.
  • Replaced Project.applyActions() with Project.configure().
  • Project.relativePath() now returns a String instead of a File.
  • Deprecated constructor DefaultTask(Project, String) has been removed.
  • PluginCollection now extends DomainObjectCollection instead of NamedDomainObjectCollection. This means methods such as getByName() are no longer available for a plugin container.
  • PluginCollection methods hasPlugin(String), findPlugin(String) and getPlugin(String) only consider those plugins with an id.
  • PluginContainer methods usePlugin() have been renamed to apply().
  • The project.mkdir(File parent, String name) method provided by the Java plugin has been replaced by project.mkdir(Object paths). The latter resolves relative paths to the project dir.
  • GradleException has been moved into the org.gradle.api package and does not have a single-argument constructor taking a Throwable; instead requires a message
  • ResolvedDependency.getGroup() has been renamed to ResolvedDependency.getModuleGroup()
Labels: