Gradle Release Notes

Version 3.0

The Gradle team is pleased to announce Gradle 3.0.

Performance continues to be a focus for the Gradle team and the third major release reflects this. The Gradle Daemon is a key performance enhancer, making builds up to 75% faster, but it needed to be explicitly enabled in previous versions of Gradle. This is no longer necessary as the Daemon is now enabled by default in 3.0. We've put a lot of effort into fixing the most significant issues with the Gradle Daemon, especially on Windows platforms. We have also been working hard to make the Gradle Daemon aware of its health and impact to the system it's running on and use this information for self-healing actions as well as better daemon status reporting. The Gradle Daemon is the foundation for a great Gradle experience.

Ever wished for better IDE support when writing Gradle build scripts? This release provides the first support for Gradle Script Kotlin, which is a Kotlin-based build language for Gradle scripts. Its deep integration with both IDEA and Eclipse provides many of the things you would expect from an IDE such as auto-completion, refactoring, navigation to source, and more. Groovy is still the primary build language for Gradle scripts and will always be supported, but we are working intensely to make Gradle Script Kotlin fully production ready by the end of the year in order to provide the best possible development experience to Gradle users. See Chris Beams's blog post for more information about this exciting new feature.

Additionally, Gradle 3.0 provides support for running on the latest Java 9 EAP builds. Users can also build and run tests using these early versions of JDK 9, but there are some limitations. Check out the section on Java 9 support below for more details.

With the release of Gradle 3.0, it's a good time to reflect on the progress we've made over the last 2 years. Check out some of the improvements since Gradle 2.0. Lots of reasons to upgrade!

We're also pleased to make available a draft of our new Performance Guide. This is intended to be a short guide that shows you how to dramatically improve your build performance in the time it takes to eat lunch. Check it out and please provide any feedback via the guide's GitHub Issues.

Promoted features Promoted features are features that were incubating in previous versions of Gradle but are now supported and subject to backwards compatibility. See the User guide section on the “Feature Lifecycle” for more information. The following are the features that have been promoted in this Gradle release.

Fixed issues

Deprecations Features that have become superseded or irrelevant due to the natural evolution of Gradle become deprecated, and scheduled to be removed in the next major Gradle version (Gradle 4.0). See the User guide section on the “Feature Lifecycle” for more information. The following are the newly deprecated items in this Gradle release. If you have concerns about a deprecation, please raise it via the Gradle Forums. Chaining TaskInputs and TaskOutputs methods Chaining the following method calls is now deprecated: TaskInputs.dir()

TaskInputs.file()

TaskInputs.files()

TaskOutputs.dir()

TaskOutputs.file()

TaskOutputs.files() With Gradle 3.0, the following now produces a deprecation warning: task myTask { inputs . file ( "input1.txt" ). file ( "input2.txt" ) } The chaining of the file(Object) method has been deprecated and is scheduled to be removed in Gradle 4.0. Please use the file(Object) method on TaskInputs directly instead. Jetty Plugin The Jetty plugin has been deprecated and will be removed in Gradle 4.0. Consider using the more feature-rich Gretty plugin instead.

Potentially breaking changes Running Gradle on Java 6 is no longer supported Gradle itself now requires Java 7 or better to run, but compiling project sources and running tests with Java 6 is still supported. See Compiling and testing for Java 6 in the Gradle Userguide. There are also instructions on how to compile and test Groovy and Scala for Java 6. Compiling and testing with Java 5 is no longer supported Support for compiling and testing on Java 5 has been removed. Sonar plugin has been removed The legacy Sonar plugin has been removed from the Gradle distribution. It is superseded by the official plugin from SonarQube. The eclipse-cdt plugin has been removed The eclipse-cdt plugin is no longer supported and has been removed. Unique default test result and report directories for Test tasks The default location of reports produced by tasks of type Test have changed to incorporate the task name when used with the Java Plugin . This allows multiple tasks of type Test to produce non-conflicting default report and result directories without additional configuration. When the Java, Groovy or Scala plugin is applied, the report directory for a task of type Test with the name integrationTest is now $buildDir/reports/tests/integrationTest and the test results directory is $buildDir/test-results/integrationTest . This means the built-in test task reports are in a different location. To revert to the previous behaviour, the reports output directory of Test tasks can be configured explicitly: test . reports . html . destination = testReportDir test . reports . xml . destination = testResultDir Ant-Based Scala Compiler has been removed The deprecated Ant-Based Scala Compiler has been removed from Gradle 3.0 and the Zinc Scala Compiler is now used exclusively. The following properties related to the Ant-Based compiler have been removed from the ScalaCompile task: daemonServer

fork

useAnt

useCompileDaemon Support for TestNG JavaDoc annotations has been removed The support for declaring TestNG tests via JavaDoc annotations has been removed. As such, the Test.testSrcDirs and the methods on TestNGOptions have also been removed. Task property annotations (e.g., @Input) on interfaces In previous versions, annotations on task properties such as @InputFile and @OutputDirectory were only taken into account when they were declared on the task class itself (or one of its super-classes). With Gradle 3.0, annotations declared on implemented interfaces are also taken into account. eclipse-wtp handling of external dependencies changed For Java projects, the eclipse-wtp plugin adds external dependencies to the classpath instead of the WTP component file. Any customizations related to external dependencies that were made in the eclipse.wtp.component.file hooks now need to be moved to the eclipse.classpath.file hooks instead. eclipse-wtp is automatically applied to war or ear projects with eclipse Projects that have the war or ear plugins applied in conjunction with the eclipse plugin will now have the eclipse-wtp plugin applied automatically. If desired, this support can be removed using the following configuration: eclipse . project { natures . removeAll { it . startsWith ( 'org.eclipse.wst' ) } buildCommands . removeAll { it . name . startsWith ( 'org.eclipse.wst' ) } } Eclipse model contains classpath attributes for project and external dependencies The EclipseProjectDependency and EclipseExternalDependency models now contain ClasspathAttribute objects. By default, the JavaDoc location attribute and WTP deployment attributes are also populated. Any customizations made via eclipse.classpath.file.beforeMerged and eclipse.classpath.file.whenMerged are also reflected. NamedDomainObjectContainers no longer create objects when using explicit parameter syntax In previous versions of Gradle, the following would create a new SourceSet named foo : sourceSets { it . foo {} } This behavior was unintended and has been removed. The above code will now cause an exception if foo has not already been defined. Creation must now use the implicit syntax: sourceSets { foo {} } Changes to previously deprecated APIs The AbstractTask methods setName() and setProject() are removed.

methods and are removed. The plus(Iterable<FileCollection>) and #minus(Iterable<FileCollection>) methods have been removed from FileCollection .

and methods have been removed from . Changing configurations after they have been resolved now throws an error.

Changing configurations after task dependencies have been resolved now throws an error.

Declaring custom check , clean , build or assemble tasks is not allowed anymore when using the lifecycle plugin.

, , or tasks is not allowed anymore when using the lifecycle plugin. Configuring the Eclipse project name during beforeMerged or whenMerged is not allowed anymore.

or is not allowed anymore. Removed --no-color command-line option (use --console=plain instead).

command-line option (use instead). Removed --parallel-threads command-line option (use --parallel + --max-workers instead).

command-line option (use + instead). Removed Zip.encoding (use Zip.metadataCharset instead).

(use instead). Removed DistributionPlugin.addZipTask() and addTarTask() .

and . The installApp task is no longer created by the application plugin (use installDist instead).

task is no longer created by the plugin (use instead). Removed Groovydoc.overview (use overviewText instead).

(use instead). Removed LoggingManager.setLevel() . It is now not possible to change the log level during the execution of a task. If you were using this method to expose Ant logging messages, please use AntBuilder.setLifecycleLogLevel() instead.

. It is now not possible to change the log level during the execution of a task. If you were using this method to expose Ant logging messages, please use instead. Removed AntScalaCompiler in favor of ZincScalaCompiler .

in favor of . Removed EclipseClasspath.noExportConfigurations property.

property. Removed ProjectDependency.declaredConfigurationName property.

property. Removed AbstractLibrary.declaredConfigurationName property.

property. Removed BuildExceptionReporter .

. Removed BuildLogger .

. Removed BuildResultLogger .

. Removed TaskExecutionLogger .

. Removed ConflictResolution .

. Removed Module .

. Removed DeleteAction .

. Removed EclipseDomainModel .

. Removed AntGroovydoc .

. Removed AntScalaDoc .

. Removed BinaryType .

. Removed LanguageType .

. Removed ConventionValue .

. Removed org.gradle.platform.base.test.TestSuiteBinarySpec replaced by org.gradle.testing.base.TestSuiteBinarySpec

replaced by Removed org.gradle.platform.base.test.TestSuiteContainer replaced by org.gradle.testing.base.TestSuiteContainer

replaced by Removed org.gradle.platform.base.test.TestSuiteSpec replaced by org.gradle.testing.base.TestSuiteSpec

replaced by TestKit supports Gradle versions 1.2 or later.

Build comparison plugin supports Gradle versions 1.2 or later.

Removed Specs.and() , Specs.or() and Specs.not()

, and Removed StartParameter.getParallelThreadCount() and StartParameter.setParallelThreadCount()

and Removed PrefixHeaderFileGenerateTask.getHeaders()

Removed org.gradle.tooling.model.Task.getProject()

Removed Logging.ANT_IVY_2_SLF4J_LEVEL_MAPPER

Removed old wrapper properties urlRoot , distributionName , distributionVersion and distributionClassifier

, , and Removed deprecated has() , get() and set() dynamic methods exposed by ExtraPropertiesDynamicObjectAdapter Groovy to Java conversions For performance reasons, all classes in Gradle's public API have been converted from Groovy to Java. As a consequence, these classes no longer extend GroovyObject . In order to retain binary compatibility, public API classes that have been converted are decorated with GroovyObject at runtime. This means plugins written for Gradle 2.x should continue working with Gradle 3.x. We are planning to drop the runtime GroovyObject decoration with Gradle 4.0. This means that plugins compiled against Gradle 2.x will no longer work with Gradle 4.0. Plugins that are compiled with Gradle 3.0 will not have references to GroovyObject and will remain compatible with Gradle 4.0. Plugins compiled with Gradle 3.0 will also work with Gradle 2.x as long as they confine themselves to the Gradle 2.x API. When recompiling your plugin with Gradle 3.0, you may need to make some changes to make it compile. One instance of this is when you use += in a statically compiled Groovy class. See GROOVY-7888.