Latest in branch 4
4.10.3
Released 04 Dec 2018
(7 years ago)
SoftwareGradle
Branch4
Status
End of life
Initial release4.0.0
14 Jun 2017
(8 years ago)
Latest release4.10.3
04 Dec 2018
(7 years ago)
End of bug fixes23 Nov 2018
(Ended 7 years, 5 months ago)
End of security fixes08 Nov 2019
(Ended 6 years, 6 months ago)
Release noteshttps://docs.gradle.org/4.10.3/release-notes.html
Source codehttps://github.com/gradle/gradle/tree/v4.10.3
Documentationhttps://docs.gradle.org/current/userguide/userguide.html
Downloadhttps://gradle.org/next-steps/?version=4.10.3&format=all
Gradle 4 ReleasesView full list

What Is New in Gradle 4

Gradle 4 delivers a mix of performance boosts, new features for Java and Android builds, and foundational improvements to the dependency resolution engine. This release focuses on faster builds and a more expressive build script DSL.

Category Key Changes
Performance & Core Compile avoidance for Java, new Gradle Daemon lifecycle, improved incremental compilation.
New Features Java Library plugin, source set dependencies, public API for custom tasks, lazy configuration.
Dependency Management Component metadata rules API, compileOnly API dependencies, BOM import support.
Improvements & Updates Updated wrapper with SHA-256 checksum, Kotlin DSL 1.0, improved error messages.
Deprecated & Breaking Changes Legacy software model deprecated, changes to Play and OSGi plugins, task output caching stable.

How does Gradle 4 speed up Java builds?

It introduces compile avoidance for Java projects. If a dependent library changes only its implementation (not its public API), Gradle skips recompiling modules that depend on it. This works with annotation processors too.

In practice, this means fewer unnecessary compilations in multi-module builds. You also get a redesigned Daemon that uses less memory and a more robust incremental compiler for Java.

What's the deal with the new Java Library plugin?

The new java-library plugin is a key addition. It extends the standard Java plugin by introducing an api configuration. Dependencies declared in api are exposed to consumers, while implementation dependencies are kept internal.

This matters because it enforces better modularity. It makes the boundaries between your project's modules explicit, which is crucial for large-scale builds and enables the new compile avoidance feature.

What improvements were made to dependency resolution?

Gradle 4 provides a public API for component metadata rules. This lets you manipulate dependency details directly in your build script, like forcing a specific version or changing a dependency's scope.

You can now also import Maven BOM (Bill of Materials) files to align dependency versions. The compileOnly configuration is now available for all JVM projects, not just Android, which is great for dependencies needed only at compile time.

Are there new ways to write build logic?

Yes, the Kotlin DSL reaches a 1.0 milestone, offering a statically-typed alternative to Groovy with better IDE support. For custom task development, there's a new public API that makes tasks easier to write and maintain.

The concept of "lazy configuration" is introduced, allowing property values to be configured lazily. This can help avoid expensive work during build configuration phase, moving it to execution time instead.

What got deprecated or changed in a breaking way?

The legacy software model (the components block) is now deprecated. The Play and OSGi plugins have breaking changes; the Play plugin requires explicit configuration, and OSGi now uses Bnd by default.

Task output caching is now stable and enabled by default. This is a big deal for CI environments, as cached task outputs can be reused across different machines, cutting down build times significantly.

FAQ

Should I switch from the 'java' plugin to 'java-library'?
Yes, for any project that is consumed as a library by other Gradle projects. Using the api and implementation configurations properly is essential for build performance and clean boundaries.

Does compile avoidance work with annotation processors?
Yes, it does. Gradle 4's compile avoidance is aware of annotation processors, so if an API doesn't change, recompilation is skipped even when processors are involved.

What happens to the old Gradle Daemon?
The old Daemon is replaced. The new one is more efficient and stops automatically after 3 hours of idle time, or you can stop it manually with gradle --stop.

Is the Kotlin DSL ready for production?
Gradle 4 marks the Kotlin DSL 1.0 release, making it stable and supported for production use. It offers excellent IDE assistance in IntelliJ IDEA.

How do I import a Maven BOM now?
Use the platform or enforcedPlatform keywords in your dependencies block. For example: implementation platform('org.springframework.boot:spring-boot-dependencies:1.5.4.RELEASE').

Releases In Branch 4

VersionRelease date
4.10.304 Dec 2018
(7 years ago)
4.10.217 Sep 2018
(7 years ago)
4.10.111 Sep 2018
(7 years ago)
4.10.027 Aug 2018
(7 years ago)
4.9.014 Jul 2018
(7 years ago)
4.8.120 Jun 2018
(7 years ago)
4.8.002 Jun 2018
(7 years ago)
4.7.017 Apr 2018
(8 years ago)
4.6.028 Feb 2018
(8 years ago)
4.5.104 Feb 2018
(8 years ago)
4.5.023 Jan 2018
(8 years ago)
4.4.115 Dec 2017
(8 years ago)
4.4.001 Dec 2017
(8 years ago)
4.3.107 Nov 2017
(8 years ago)
4.3.027 Oct 2017
(8 years ago)
4.2.102 Oct 2017
(8 years ago)
4.2.013 Sep 2017
(8 years ago)
4.1.031 Jul 2017
(8 years ago)
4.0.224 Jul 2017
(8 years ago)
4.0.106 Jul 2017
(8 years ago)
4.0.014 Jun 2017
(8 years ago)