Gradle 5.0 is here: Now with Java 11 support, production ready Kotlin DSL, and more!
We’ve been keeping an eye out for Gradle, since rc.1 dropped earlier this month. Now, Gradle 5.0 is here! This major release comes with all kinds of new features and changes for developers, including Java 11 support, production ready Kotlin DSL, dependency alignment, task timeouts, and more!
Gradle 5.0 is here! We’ve been waiting excitedly since the rc 1 dropped earlier this month, but now it’s finally here! Now, developers can build, automate, and deliver better software faster than ever.
Gradle 5.0 comes with all kinds of major changes and new features for developers to enjoy and explore. At the top of the list are Java 11 support and a production-ready DSL, but there’s more to this release. In fact, we can hardly go over everything, so head on over to the Gradle website to see the full list of changes, available here.
Let’s dive right in and see what’s in store for developers!
To start, Gradle Kotlin DSL is now production-ready with a 1.0 release! Developers can author their build logic using Kotlin to provide a considerable amount of additional editing assistance in their IDEs of choice. This includes editing features like improved completion, error highlighting, quick documentation, and refactoring.
Previously, Gradle focused on Groovy and while they are making the switch to Kotlin, the Groovy DSL will not be depreciated.
Gradle 5.0 now supports Java 11. Developers can run Gradle builds with JDK 11.
This release also introduces dependency version alignment, which allows different modules belonging to the same logical group (a
platform) to have identical versions in a dependency graph. Maven BOMS can be imported to define platforms as well. More information about handling inconsistent module versions is available here.
There are some pretty significant changes to the Gradle build initialization features in the 5.0 release. The changes to
gradle init include:
- It is now optionally interactive. If developers run the
inittask from an interactive console, Gradle will prompt them for details of the build they’d like to generate.
inittask can generate a Kotlin library or application, using the the
- Developers can generate builds using recommended configurations. The
inittaskgenerates build scripts that use the recommended
testRuntimeOnlyconfigurations instead of
testRuntime, respectively, for all build setup types.
- Now, developers can configure project and source package names in an
inittask also creates more empty resource directories.
- Although the
inittask does not automatically create a Git repository, now it will create a
.gitignorefile to make it easier to set one up. This file ignores Gradle’s build outputs.
Every task has a timeout property. The task timeout can be used to limit its execution time. When said task reaches its timeout, the task execution thread is interrupted and the task is marked as failed.
Gradle Docs is a lot more searchable now! There is now an index that users can search for information on both the user manual and DSL references.
New performance features for Gradle 5.0 include:
- Gradle can be started as a low-priority process
- Plural task output properties don’t disable caching anymore
- JaCoCo plugin now works with the build cache and parallel test execution
- Plugin authoring features, including a public method to create SourceDirectorySet instances
Plus, the Gradle Native project continues to grow and expand!
Getting Gradle 5.0
Looking to upgrade your version of Gradle? There’s a detailed upgrade guide for developers who already have a Gradle build here. Keep in mind there are some breaking changes and considerations for any developer moving from 4.x up. There’s also an installation guide for any new developers looking to start their epic Gradle journey, available here.