What's New in Gradle 7.0
Gradle 7.0 marks a strong upgrade focused on faster incremental builds, stronger security, and better support for modern Java development. It turns on file system watching by default for quicker up-to-date checks, adds native Apple Silicon compatibility, fully supports Java 16 including the module system, and introduces experimental centralized dependency management with version catalogs. Security gets a boost through dependency verification and wrapper checksum checks to guard against supply-chain issues. Build authoring improves with precompiled script plugins, easier included build usage, and more reliable conventions. Performance gains come from smarter caching, reduced disk I/O, and optimized Kotlin DSL compilation. This version upgrades Groovy to 3.0 and Kotlin to 1.4, bringing some changes but delivering smoother, more trustworthy builds overall.
Performance Improvements
Incremental builds run noticeably faster thanks to several smart changes:
- File system watching is enabled by default on Windows, Linux, and macOS, cutting down disk scans during up-to-date checks.
- Build cache ignores irrelevant changes like empty directories, whitespace, or comments in properties files for higher hit rates.
- PMD plugin uses incremental analysis by default (needs PMD 6.0.0 or higher).
- Dependency cache becomes relocatable and shareable across Gradle instances or machines to avoid repeated downloads.
- Kotlin DSL scripts compile quicker with lower memory use and skip recompilation when shared logic in
buildSrcchanges.
Java Toolchains and Java 16 Support
Toolchains let you build with a specific Java version regardless of what runs Gradle. You set it like this:
java {
toolchain {
languageVersion = JavaLanguageVersion.of(16)
}
}
Gradle finds local JDKs or downloads them automatically. Full Java 16 support covers compilation, testing, execution, and the module system. This works well with AdoptOpenJDK and tools like SDKMAN! or asdf-vm.
Dependency Management and Security
Centralize repositories and metadata rules in settings.gradle:
dependencyResolutionManagement {
repositories {
mavenCentral()
}
components {
withModule('com.google.guava:guava', GuavaRule)
}
}
Experimental version catalogs declare coordinates in one place for easy reuse. Dependency locking switches to a single file per project with automatic migration. Security features include verifying checksums and signatures for dependencies and plugins, plus exclusive repository content to prevent wrong resolutions. Wrapper JAR integrity checks stop tampering.
Build Authoring Enhancements
Precompiled script plugins (Groovy or Kotlin) can be tested, published, and applied via the plugins {} block. Included builds integrate better with buildSrc and support plugin development in composites. You can run tasks from included builds directly, like gradle :other-project:task. Type-safe project accessors (experimental) improve IDE completion for inter-project dependencies.
Apple Silicon and Platform Support
Native support arrives for Macs with Apple Silicon (M1 chips), so builds run efficiently without Rosetta emulation. This pairs nicely with Java 16 toolchains for consistent cross-platform development.
Groovy and Kotlin Updates
Groovy upgrades to 3.0 in Gradle 7.0, enabling JDK 16 compatibility and modern features but introducing some breaking changes in Groovy DSL scripts and Groovy-based plugins. Kotlin DSL uses Kotlin 1.4 level for better language support in build scripts.
Deprecations, Removals, and Breaking Changes
Groovy 3.0 may affect custom Groovy DSL logic or plugins -- review scripts and update plugins. Dependency lock format changes to one file per project. Some older IDE model methods are removed. PMD users on versions below 6.0.0 need to disable incremental analysis manually. No major removals hit most projects, but check the upgrade guide for Groovy specifics.
Upgrade Notes
Upgrade step by step: move to Gradle 6.9 first, run gradle help --scan to spot deprecations, fix plugins, then update to 7.0 with the wrapper. Test thoroughly for Groovy 3 changes if you use Groovy DSL heavily. Enable file system watching and try version catalogs in new projects. Java toolchain setup helps with consistent environments. Most builds gain speed and security with minimal effort after addressing Groovy compatibility.