3 min read

The team at Gradle has now released Gradle 5.0 after Gradle 4.9 was released in July this year. Gradle 5.0 is faster, safer and more capable than the previous ones. Gradle is a build tool which accelerates developer productivity as it helps teams build, automate and deliver software faster. This tool focuses on build automation and support for multi-language development.

Improvements in Gradle 5.0

Gradle 5.0 comes incremental compilation and annotation processing to enhance caching and up-to-date checking. Gradle 5.0 also brings features such as Kotlin DSL, dependency version alignment, version locking, task timeouts, Java 11 support, and more. The Kotlin DSL helps the IDE users in code completion and refactoring.

Faster builds with build cache

Users can experience faster builds the moment they upgrade to Gradle 5.0. Gradle 5.0 allows developers and business executives to build only what is needed by using the build cache and incremental processing features. The build cache reuses the results of previous executions and makes the process faster. It also reduces the build time by approximately 90%.

Incremental Java compilation and annotation processing

Gradle 5.0 features an incremental compiler. Now, there is no need for CompileJava tasks to recompile all the source files except for the the first time This compiler is default in this version and is highly optimized. It also supports incremental annotation processing which increases the effectiveness of incremental compilation in the presence of annotation processors. Users have to upgrade to the latest version (5.0) of the processors to experience the annotation processing. The new annotationProcessor configuration is used to manage the annotation processors and for putting them on the annotation processor path.

Fine-grained transitive dependency management

  • Gradle 5.0 comes with new features for customizing dependencies and features for improved POM and BOM support.
  • Gradle 5.0 supports dependency constraints that are used to define versions or version ranges to restrict direct and transitive dependency versions.
  • In this version, the platform definitions or Maven BOM dependencies are natively supported which allows the use of Spring Boot platform definition without using an external plugin.
  • The dependency alignment aligns the modules in a logical group.
  • With this release, the dynamic dependency versions can now be locked for better build reproducibility.
  • This version can import bill of materials (BOM) files.

Writing Gradle build logic

  • Users can now write Gradle build scripts in Kotlin.
  • The functionality of Static-typing in Kotlin allows tools to provide better IDE assistance to the users.

More memory efficient Gradle execution

  • The lower memory requirements and cache cleanup reduces Gradle’s overhead on the system.
  • In Gradle 5.0, many caching mechanisms have been optimized for reducing the default memory for Gradle processes.

New Gradle invocation options

  • This version supports JUnit 5: JUnit Platform, JUnit Jupiter, and JUnit Vintage which helps in enabling test grouping and filtering.
  • The tasks for non-interactive environments like continuous integration execution group the log messages.
  • It’s now easy to identify if a test has failed with arich command-line console as it shows a colored build status.
  • One can now work on interdependent projects with the help of composite builds in Gradle 5.0.
  • This release of Gradle supports custom arguments which help in running Java applications faster and easier.

New Gradle task and plugin APIs

  • This version of Gradle features a new Worker API for safe parallel and asynchronous execution.
  • Gradle 5.0’s new Configuration Avoidance APIs allow  users to configure projects together.
  • The task timeout API helps to specify a timeout duration for a task, after which it will be interrupted.
  • Custom CLI args in Gradle 5.0 helps the users to configure their custom tasks.

 

To know more about Gradle 5.0. check out Gradle’s official blog.

Read Next

Gradle 4.9 released!

Android Studio 3.2 Beta 5 out, with updated Protobuf Gradle plugin

Setting Gradle properties to build a project [Tutorial]


Subscribe to the weekly Packt Hub newsletter. We'll send you the results of our AI Now Survey, featuring data and insights from across the tech landscape.

* indicates required