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:
namepathconventionhasProperty()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 thefrom()method:
0.8 |
0.9 |
|---|---|
| |
|
- The
zipFileSet()method has been replaced with thefrom()andinto()methods. The equivalent ofprefix,fileModeanddirModeare supported. There is no replacement forfullPath.
0.8 |
0.9 |
|---|---|
| |
|
- The
tarFileSet()method has been replaced by thefrom()andinto()methods, as forzipFileSet(). There are no replacements foruserName,group,uidorgid.
- The
customNameproperty has been merged into thearchiveNameproperty
0.8 |
0.9 |
|---|---|
| |
|
- The
resourceCollections()method has been replaced by thefrom()method.
0.8 |
0.9 |
|---|---|
| |
|
- The
merge()andmergeGroup()methods have been removed. You can useProject.zipTree()andProject.tarTree()to achieve the same thing:
0.8 |
0.9 |
|---|---|
| |
|
- The
antDirective()method has been removed. There is no replacement. - The
createIfEmpty,baseDir,resourceCollections,mergeFileSetsandmergeGroupFileSetsproperties 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
metaInfResourceCollectionsproperty has been replaced by themetaInf() {...} method. This operates the same as if a call tointo('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
remapTargetmethod has been removed. You can use therenamemethod instead. - The parameter of the
intomethod for a nested copy spec is now evaluated relative to the parent spec's destination directory.
Test task
- The
Testtask now always executes the tests in a forked process. - The
stopAtErrorsOrFailuresproperty has been replaced by theignoreFailuresproperty.
JUnit Tests
- The
forkModeproperty has been replaced by aforkEveryproperty.0.8
0.9
- A number of properties have been moved from
JUnitOptionstoTest0.8
0.9
- Removed the
filterTrace,fork,forkOptions,formatterOptions,outputToFormatters,printSummary,reloading,showOutputandtempDirproperties fromJUnitOptions. - Removed the
cloneVm,newEnvironmentandtimeoutproperties fromJUnitForkOptions.0.8
0.9
TestNG Tests
- A number of properties have moved from
TestNGOptionstoTest0.8
0.9
- The
skippedProperty,dumpCommand,suiteRunnerClassproperties have been removed fromTestNGOptions.
Clean task
- The
Cleantask has been replaced by theDeletetask.
EclipseClean task
- The
EclipseCleantask has been replaced by theDeletetask.
Plugin Authoring
- The
Plugininterface has changed, so that it can target any time of object. The signature ofPlugin.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.propertiesfile has been removed. Instead, you can add a resource calledMETA-INF/gradle-plugins/$plugin-id.propertiesto 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-importscommand-line options have been removed. - The JDK 1.4 compatible distribution is no longer available.
- The
default-importsfile is no longer available in the Gradle distribution.
API Changes
org.gradle.api.TaskActionandorg.gradle.api.ProjectActionhave been replaced byorg.gradle.api.Action.SettingsandGradlemethodsdisableStandardOutputCapture(),captureStandardOutput()andgetLogger()have been removed. You can use the replacements onorg.gradle.api.Script.- Replaced
Project.applyActions()withProject.configure(). Project.relativePath()now returns aStringinstead of aFile.- Deprecated constructor
DefaultTask(Project, String)has been removed. PluginCollectionnow extendsDomainObjectCollectioninstead ofNamedDomainObjectCollection. This means methods such asgetByName()are no longer available for a plugin container.PluginCollectionmethodshasPlugin(String),findPlugin(String)andgetPlugin(String)only consider those plugins with an id.PluginContainermethodsusePlugin()have been renamed toapply().- The
project.mkdir(File parent, String name)method provided by the Java plugin has been replaced byproject.mkdir(Object paths). The latter resolves relative paths to the project dir. GradleExceptionhas been moved into the org.gradle.api package and does not have a single-argument constructor taking aThrowable; instead requires a messageResolvedDependency.getGroup()has been renamed toResolvedDependency.getModuleGroup()
