Gradle Release Notes

Version 4.6

The Gradle team is pleased to announce Gradle 4.6.

First and foremost, this release of Gradle includes built-in support for JUnit Platform and the JUnit Jupiter/Vintage Engine, also known as JUnit 5 support. You can use the new filtering and engines functionality in JUnit 5 using the examples provided below and in the documentation.

Thank you to the JUnit team for helping to achieve JUnit Platform support, and a special thank you to Andrew Oberstar for extraordinary contributions toward this effort.

Also regarding testing, you can now improve your testing feedback loop when running JVM-based tests using the new fail-fast option for Test tasks, which stops the build immediately after the first test failure.

test { useJUnitPlatform { excludeTags 'slow' includeEngines 'junit-jupiter' , 'junit-vintage' } failFast = true }

Moving on to dependency management improvements: you can now declare dependency constraints for transitive dependencies and avoid problems caused by oft-hidden upstream dependency changes.

This release also features enhanced Maven dependency compatibility: support for importing BOMs, optional dependencies, and compile/runtime separation when consuming POMs. For now you must enable these features by adding enableFeaturePreview('IMPROVED_POM_SUPPORT') to your settings.gradle file, as they break backward compatibility in some cases.

This version of Gradle also comes with a couple especially useful new APIs for task development. You can now declare custom command-line flags for your custom tasks, for example: gradle myCustomTask --myfoo=bar . In addition, tasks that extend Test , JavaExec or Exec can declare rich arguments for invoking the underlying executable. This allows for better modeling of tools like annotation processors.

Speaking of annotation processors, it is now more convenient to declare dependencies that are annotation processors through the new annotationProcessor dependency configuration. Using a separate dependency configuration for annotation processors is a best practice for improving performance.

Kotlin DSL v0.15.6 is included in this release of Gradle, and features initialization scripts support, nicer script compilation error reporting, performance improvements, and better IntelliJ IDEA integration. Details are available in the linked release notes.

We hope you will build happiness with Gradle 4.6, and we look forward to your feedback via Twitter or on GitHub.

Upgrade instructions Switch your build to use Gradle 4.6 quickly by updating your wrapper properties: gradle wrapper -- gradle - version = 4.6 Standalone downloads are available at gradle.org/releases.

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. Build cache and task output caching marked stable The build cache and task output caching were first introduced in Gradle 3.5. They are used in production by different teams, including the Gradle team itself, with great results. As of Gradle 4.6, the build cache and task output caching are no longer incubating and considered public features. Note that the SPI to implement your own build cache service stays incubating. TestKit marked stable TestKit was first introduced in Gradle 2.6 to support developers with writing and executing functional tests for plugins. In the course of the Gradle 2.x releases, a lot of new functionality was added. This version of Gradle removes the incubating status and makes TestKit a stable feature. CompileOptions.annotationProcessorPath property The CompileOptions.annotationProcessorPath property has been promoted and is now stable.

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 5.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. Putting annotation processors on the compile classpath or explicit -processorpath compiler argument Putting processors on the compile classpath or using an explicit -processorpath compiler argument has been deprecated and will be removed in Gradle 5.0. Annotation processors should be added to the annotationProcessor configuration instead. If you don't want any processing, but your compile classpath contains a processor unintentionally (e.g. as part of some library you use), use the -proc:none compiler argument to ignore it. Play 2.2 is deprecated in Play plugin The use of Play 2.2 with the the Play plugin has been deprecated and will be removed with Gradle 5.0. It is highly recommended to upgrade to a newer version of Play. CompilerArgumentProvider replaced by CommandLineArgumentProvider The interface CompilerArgumentProvider has been deprecated. Use CommandLineArgumentProvider instead.

Potential breaking changes Local build cache directory cleanup is now time-based Previously, Gradle would clean up the local build cache directory only if the size of its contents reached 5 GB, or whatever was configured in targetSizeInMB . From now on Gradle will instead clean up everything older than 7 days, regardless of the size of the cache directory. As a consequence targetSizeInMB is now deprecated, and changing its value has no effect. The minimum age for entries to be cleaned up can now be configured in settings.gradle via the removeUnusedEntriesAfterDays property: buildCache { local { removeUnusedEntriesAfterDays = 30 } } Added annotationProcessor configurations The java-base plugin will now add an <sourceSetName>AnnotationProcessor configuration for each source set. This might break when the user already defined such a configuration. We recommend removing your own and using the configuration provided by java-base . Changes to Visual Studio IDE configuration VisualStudioExtension no longer has a solutions property. There is now only a single solution for a multi-project build that can be accessed through the VisualStudioRootExtension on the root project. For instance: model { visualStudio { solution { solutionFile . location = "vs/${name}.sln" } } } Removed Visual Studio IDE tasks There are no longer tasks to generate Visual Studio solution files for each component in the build. There is now only a single task ( visualStudio ) in the root project that generates a solution containing all components in the build. Removed StartParameter.taskOutputCacheEnabled The deprecated property StartParameter.taskOutputCacheEnabled has been removed. Use StartParameter.buildCacheEnabled instead. HttpClient library upgraded to version 4.5.5 Gradle has been upgraded to embed HttpClient version 4.5.5 over 4.4.1. Kotlin Standard Library for Java 8 artifact changes Gradle now bundles the Kotlin Standard Library Java 8 artifact kotlin-stdlib-jdk8 instead of kotlin-stdlib-jre8 as a follow up to the upgrade to Kotlin 1.2. This change might affect your build, please see the Kotlin documentation about this change.

External contributions We would like to thank the following community members for making contributions to this release of Gradle. Andrew Oberstar - Spike multiple JUnit 5 implementations (gradle/gradle#3886)

Thomas Broyer - Add annotationProcessor configuration for each source set (gradle/gradle#3786)

Sergei Dryganets - Improved gpg instructions in signing plugin documentation (gradle/gradle#4023)

Kevin Macksamie - Fix xref id to java-gradle-plugin section of user guide (gradle/gradle#4179)

Devi Sridharan - Make PlatformScalaCompile cacheable (gradle/gradle#3804) We love getting contributions from the Gradle community. For information on contributing, please see gradle.org/contribute.