Skip to end of metadata
Go to start of metadata

This is a list of some of the breaking changes from 0.5 to 0.6.

Dependency and Artifact Handling Changes

In 0.6 repository and configuration declarations have been moved out of the dependencies configuration closure. See below for some details.

See UG 21 and UG 22 for all the changes.

Task Changes

The createTask() method has been deprecated and will be removed in a later release. It has been replaced by the task() method. The following shows a couple of common cases:

0.5

0.6

One imporant thing to note here is that when you provide a closure when you define a task, the closure is now treated as a configuration closure, and executed at configuration time. In 0.5 it was treated as a task action, and executed at execution time.

For code which defines tasks programatically, you should now use the add() method on TaskContainer to define tasks. See TaskContainer for details.

See UG 4 and UG 12 for more examples.

Repositories

Repositories are no longer declared inside dependencies closure, but inside a repositories closure.  See the javadoc for RepositoryHandler for details on the methods allowed here.  Note that the parameters to the methods for adding repositories now take a Map.  Here are some examples and how they differ from 0.5 to 0.6.

0.5

0.6

Configurations

Custom configurations are no longer declared inside of the dependencies closure, but inside of a configurations closure.  New configurations can be created by simply referencing them as shown:

0.5

0.6

project.configurations now returns a ConfigurationContainer
so:

0.5

0.6

Tasks

  • project.tasks now returns a TaskContainer rather than a Map.
  • org.gradle.api.tasks.Resources renamed to Copy.
  • Methods task(path) and findTask(path) have been replaced with tasks.getByPath(path) and tasks.findByPath(path).

Java Plugin

Some task have been renamed:

Old Name

New Name

testCompile

compileTests

resources

processResources

testResources

processTestResources

archive_jar

jar

archive_war

war

In addition, the way you specify additional archives has changed. Both the libs and dists tasks are now simple tasks, and you add an additional archives by defining a task with type Jar, Zip, War, or Tar:

0.5

0.6

When you add a JAR or WAR archive, it becomes a dependency of the libs task. When you add a ZIP or TAR archive, it becomes a dependency of the dists task.

Property archivesBaseName has been moved from Project to BasePluginConvention. That this means that you must set this property only after applying the Java/Groovy/War plugin. It will have no effect if you set it before applying the plugin.

Jetty Plugin

  • The jettyRunExploded task has been removed.
  • systemProperties has been removed from the Jetty tasks.
  • useTestClasspath, testClassesDir and testConfiguration have been removed from JettyRun task.

Project

Various changes to the Project interface:

  • Method getBuildFileName() has been replaced with getBuildFile()
  • Method addAfterEvaluateListener(Closure) has been renamed to afterEvaluate(Closure)
  • Method addAfterEvaluateListener(AfterEvaluateListener) has been replaced by afterEvaluate(ProjectAction). You can also use Build.afterProject(Action) and Build.addProjectEvaluateListener(ProjectEvaluateListener)
  • Property archivesTaskBaseName has been removed.

Settings Script

  • ProjectDescriptor.getDir() and setDir() have been renamed to getProjectDir() and setProjectDir()

Misc

  • org.gradle.api.tasks.util.FileCollection has been removed. It has been replaced by org.gradle.api.artifacts.FileCollection
Labels: