Gradle 6.4 Released with Support for Java Modules
The latest version of the Gradle open-source build automation tool, just announced, comes with a number of upgrades, bug fixes, and highly anticipated support for building and testing Java modules, precompiled Groovy DSL script plugins, and a single dependency lock file per project feature.
With this release, Gradle supports the Java Module System with everything needed compile and execute tests for Java modules. Devs can also build Javadoc and run applications. "While there is some overlap with Gradle's dependency management features," the release notes state, "Java Modules offer additional features, like module boundaries, that are enforced by the Java runtime."
Modularity, which came with the Java SE 9 Platform release in 2017, brought a fundamentally new kind of programming component to Java—a module, which is a reusable group of related packages, resources, and a descriptor specifying the module's name, dependencies, and other characteristics.
With this release, Gradle now allows precompiled script plugins to be written using the Groovy DSL (domain-specific language), in addition to the Kotlin DSL. The Kotlin DSL introduced precompiled script plugins that look like regular build scripts, but have all of the advantages of binary plugins.
Dependency locking is a necessary mechanism for creating reproducible builds, even when using dynamic dependency versions. This release adds an improved dependency locking file format that results in fewer lock files in most projects that use this feature, the release notes state. In addition, when using this format, the lock file name and location can be configured.
This release also introduces clearer variant matching error messages for the JVM ecosystem. "In previous releases, these error messages could be difficult to understand and sometimes lacked enough context to figure out what to do," the release notes state. "Gradle 6.4 improves these error messages by making them more human-readable and introducing colors to the console to highlight problems."
Also in this release, the PMD plugin, which performs quality checks on a project's Java source files using the PMD source code analyzer, uses incremental analysis by default. This can significantly reduce analysis time on subsequent builds, the release notes state. Also, the PMD plugin now allows users to set the number of violations before the build fails, which can make it easier to introduce PMD into existing projects that may initially have many violations.
For more information about deprecations, breaking changes, and other considerations when upgrading to Gradle 6.4, see the Gradle 6.x upgrade guide.
John K. Waters is the editor in chief of a number of Converge360.com sites, with a focus on high-end development, AI and future tech. He's been writing about cutting-edge technologies and culture of Silicon Valley for more than two decades, and he's written more than a dozen books. He also co-scripted the documentary film Silicon Valley: A 100 Year Renaissance, which aired on PBS. He can be reached at [email protected].