What's New in Gradle 6.0
Gradle 6.0 focuses on making dependency management more powerful and flexible with Gradle Module Metadata as the default publication format. It brings big speedups to incremental compilation for Java, Groovy, and Scala projects, adds first-class support for test fixtures and sources/Javadoc jars, and improves plugin authoring with new APIs and services. Security gets attention through better signing and warnings about insecure HTTP usage. Usability tweaks include faster project bootstrapping, centralized plugin versions, and better Windows support for long classpaths. This version also upgrades tooling APIs, promotes several incubating features to stable, and prepares builds for modern Java versions up to 13. Overall, it helps teams manage dependencies smarter, compile faster, and write cleaner build logic with fewer surprises.
Dependency Management Overhaul
The biggest area of improvement is dependency handling. Gradle Module Metadata becomes the default when publishing with maven-publish or ivy-publish plugins. This format unlocks richer features that work across projects and external libraries alike.
- Platforms let you share and enforce version recommendations or strict rules across modules -- perfect for BOM-like behavior.
- Capabilities help resolve conflicts between mutually exclusive dependencies, like picking one logging implementation.
- Dependency constraints let you nudge transitive versions without adding direct dependencies.
- Version alignment keeps related modules (for example, all Jackson jars) on the same version.
- Rich versions add context, strict requirements, rejections, or preferences with descriptions for better documentation.
- Component metadata rules fix or enhance published metadata, adding constraints, variants, or extra artifacts.
- Feature variants model optional library parts as separate consumable units.
Faster Incremental Compilation
Compilation gets much smarter and quicker:
- Java incremental compiler skips recompiling classes that only reference unchanged implementation details, cutting work in large dependency chains -- real projects see compile times drop from seconds to fractions of a second.
- Groovy compilation adds avoidance (skips unchanged dependent projects) and incremental recompilation of only affected files.
- Scala uses Zinc 1.3.0 for better incremental performance and bug fixes -- no more support for Scala 2.9.
- PMD plugin supports incremental analysis when enabled in configuration.
Java and Sources/Javadoc Support
Built-in handling for Javadoc and sources jars makes publishing cleaner:
java {
withJavadocJar()
withSourcesJar()
}
These jars publish automatically as variants in Gradle Module Metadata, so consumers can easily grab documentation or sources. Gradle runs on JDK 8 to 13 and supports compilation/testing on older JDK 6/7 via toolchains.
Test Fixtures and Build Authoring
Test fixtures become first-class citizens. Use the java-test-fixtures plugin with java-library to share test helpers between projects:
dependencies {
testImplementation testFixtures(project(':my-lib'))
}
Central plugin version management in settings.gradle keeps versions in one place:
pluginManagement {
plugins {
id 'org.my.plugin' version '1.1'
}
}
gradle init supports more templates including Java, Kotlin, Groovy, C++, Swift, and Gradle plugins. Task filtering by group and fail-on-deprecation warnings help keep builds clean.
Plugin Authoring and Tooling APIs
Plugin developers get helpful new tools:
- Managed properties for
ConfigurableFileTreeand containers. - Injected services like
FileSystemOperationsandExecOperationsin tasks and workers. - Worker API supports these services for safer parallel execution.
- Tooling API adds test output events for better IDE integration.
Native plugins (C++, Swift) promote to stable, along with incremental task APIs and older lazy configuration features.
Security and Usability Tweaks
Signing plugin switches to SHA512 over SHA1, adds in-memory subkey support, and publishes SHA256/SHA512 signatures automatically. Gradle warns about HTTP usage for repositories, caches, and scripts -- use allowInsecureProtocol = true to opt in where needed.
Windows builds handle very long classpaths by creating a manifest JAR. Wrapper shows download progress and recovers from bad distributions. Daemon logs include timestamps.
Deprecations and Breaking Changes
Unannotated task properties or missing normalization (like @PathSensitive) trigger deprecation warnings -- these become errors in Gradle 7.0. HTTP deprecation warnings appear everywhere insecure protocols are used. Build scan plugin ID changes from com.gradle.build-scan to com.gradle.enterprise.
Upgrade Notes
Upgrade step-by-step: move to Gradle 5.6.4 first, run gradle help --scan to catch deprecations, update plugins, then switch to 6.0 via the wrapper. Check for task input/output annotations and normalization in custom tasks. Most projects see immediate wins from faster compilation and better dependency control with little disruption after addressing warnings. Review the upgrade guide for any Groovy or plugin-specific adjustments.