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
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 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 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
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
Three tasks have been added to the Java plugin:
For more details, see the user guide
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
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
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
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
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.
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.
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.
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 option \-f has been renamed to \-S.
Command-line option \-I now specifies an init script. You can use \--no-imports instead.
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 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.${task.name}") != null }
}
Many of the properties used to configure the locations of resource and Java source have changed. Below are some examples:
0.7 | 0.8 |
---|---|
srcDirs | sourceSets.main.java.srcDirs |
srcDirsNames << 'somedir' | sourceSets.main.java.srcDir 'src/somedir' |
floatingSrcDirs << file('somedir') | sourceSets.main.java.srcDir file('somedir') |
resourceDirs | sourceSets.main.resources.srcDirs |
resourceDirsNames << 'somedir' | sourceSets.main.resources.srcDir 'src/somedir' |
floatingResourceDirs << file('somedir') | sourceSets.main.resources.srcDir file('somedir') |
testSrcDirs | sourceSets.test.java.srcDirs |
testSrcDirNames << 'somedir' | sourceSets.test.java.srcDir 'src/somedir' |
floatingTestSrcDirs << file('somedir') | sourceSets.test.java.srcDir 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') |
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") |
0.7 | 0.8 |
---|---|
webAppDirName = 'somedir' | webAppDirName = 'src/somedir' |
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.
0.7 | 0.8 |
---|---|
jar { files 'a', 'b' } | jar { from 'a', 'b' } |
0.7 | 0.8 |
compile.srcDirs = [new File('src1'), new File('src2')] | compileJava.source = ['src1', 'src2'] |
0.7 | 0.8 |
compile.options.compilerArgs = [[value: '-Xlint'], [value: 'othervalue']] | compile.options.compilerArgs = ['-Xlint', 'othervalue'] |
0.7 | 0.8 |
|
|