Skip to content

5.0

Compare
Choose a tag to compare
@bamboo bamboo released this 26 Nov 13:02
· 57263 commits to release since this release
7fc6e5a

The Gradle team is excited to announce Gradle 5.0.

This release features a production-ready Kotlin DSL, dependency version alignment (similar to and usable with Maven BOMs), task timeouts, Java 11 support, and more.

These release notes list what's new since Gradle 4.10. You can review the highlights since Gradle 4.0 here.

Read the Gradle 5.0 upgrade guide to learn about breaking changes and considerations for upgrading from Gradle 4.x.

We would like to thank the following community contributors to this release of Gradle: Jean-Baptiste Nizet, Jonathan Leitschuh, Ben McCann, Björn Kautler, Georg Friedrich, Stefan M., Xiang Li, Theodore Ni, James Justinic, Mike Kobit, Alex Saveau, Kevin Macksamie, Cliffred van Velzen, Artem Zinnatullin, Jakub Strzyżewski, Martin Dünkelmann, Thad House, Dan Sanduleac, Felipe Lima, and thc202.

Kotlin DSL 1.0

First and foremost, Gradle Kotlin DSL is now production-ready with it's 1.0 release! Authoring your build logic using Kotlin provides significant additional editing assistance in IDEs, including: improved completion, error highlighting, and refactoring tools. Please read our Gradle Kotlin DSL Primer and follow our migrating build logic from Groovy to Kotlin guide if you're interested. If you prefer the flexibility and dynamic features of Groovy, that's totally okay — the Groovy DSL will not be deprecated.

Kotlin DSL

Dependency version alignment

This version of Gradle introduces dependency version alignment. This allows different modules belonging to the same logical group (platform) to have identical versions in a dependency graph. Maven BOMs can be imported to define platforms as well.

dependencies {
    // import a BOM. The versions used in this file will override any other version found in the graph
    implementation(enforcedPlatform("org.springframework.boot:spring-boot-dependencies:1.5.8.RELEASE"))
    
     // define dependencies without versions
    implementation("com.google.code.gson:gson")
    implementation("dom4j:dom4j")
    
     // this version will be overriden by the one found in the BOM
    implementation("org.codehaus.groovy:groovy:1.8.6")
}

More details about BOM import can be found in this section of the userguide.

Gradle build initialization features

gradle init functionality has been upgraded in this release: is now optionally interactive, includes new kotlin-library and kotlin-application project types, provides options for configuring project and package names, and more.

interactive gradle init

Searchable documentation

Search for Gradle Docs is back. The kind folks at Algolia kindly host an index used to allow you to search the user manual and DSL reference.

Docsearch demo

Gradle API Javadocs now take advantage of Javadoc built-in autocomplete, making it easier to find classes and methods you're interested in.

Task timeouts

You can now specify a timeout duration for a task, after which it will be interrupted. Read more about task timeouts in the docs.

HTTP retries during dependency resolution

When Gradle attempts to connect to a remote repository via HTTP, if it fails, Gradle will retry before blacklisting the repository.

No extra configuration is needed. See the section on HTTP retries for more information.

Performance features

Gradle can now be started as a low-prority process. This ensures that other applications like your IDE or browser stay responsive, even while a very demanding build is running.

When using @OutputFiles or @OutputDirectories with an Iterable type, Gradle used to disable caching for the task. This is no longer the case, and using such properties doesn't prevent the task from being cached. The only remaining reason to disable caching for the task is if the output contains file trees.

The JaCoCo plugin plugin now works seamlessly with the build cache. When applying the plugin with no extra configuration, the test task stays cacheable and parallel test execution can be used.

Java 11 runtime support

Java enthusiasts will be happy to read that this release supports running Gradle builds with JDK 11.

Plugin authoring features

This release introduces useful changes for plugin and custom task authors, including an API for creating SourceDirectorySets, improvements to the Provider API, and improved build cache compatibility.

Gradle Native features

The Gradle Native project continues to improve and evolve the native ecosystem support for Gradle.

Upgrade Instructions

Switch your build to use Gradle 5.0 by updating your wrapper properties:

./gradlew wrapper --gradle-version=5.0

Standalone downloads are available at gradle.org/release-candidate.

Reporting Problems

If you find a problem with Gradle 5.0, please file a bug on GitHub Issues adhering to our issue guidelines. If you're not sure you're encountering a bug, please use the forum.

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