We are excited to announce Gradle 9.1.0-20250628022042+0000 (released 2025-06-28).
This release features 1, 2, ... n, and more.
We would like to thank the following community members for their contributions to this release of Gradle:
Be sure to check out the public roadmap for insight into what's planned for future releases.
Switch your build to use Gradle 9.1.0-20250628022042+0000 by updating the wrapper in your project:
./gradlew wrapper --gradle-version=9.1.0-20250628022042+0000 && ./gradlew wrapper
See the Gradle 9.x upgrade guide to learn about deprecations, breaking changes, and other considerations when upgrading to Gradle 9.1.0-20250628022042+0000.
For Java, Groovy, Kotlin, and Android compatibility, see the full compatibility notes.
AttributeContainer#addAllLater
This release introduces a new API on AttributeContainer
allowing all attributes from one attribute container to be lazily added to another.
Consider the following example demonstrating the new API's behavior:
val color = Attribute.of("color", String::class.java)
val shape = Attribute.of("shape", String::class.java)
val foo = configurations.create("foo").attributes
foo.attribute(color, "green")
val bar = configurations.create("bar").attributes
bar.attribute(color, "red")
bar.attribute(shape, "square")
assert(bar.getAttribute(color) == "red") // `color` is originally red
bar.addAllLater(foo)
assert(bar.getAttribute(color) == "green") // `color` gets overwritten
assert(bar.getAttribute(shape) == "square") // `shape` does not
foo.attribute(color, "purple")
bar.getAttribute(color) == "purple" // addAllLater is lazy
bar.attribute(color, "orange")
assert(bar.getAttribute(color) == "orange") // `color` gets overwritten again
assert(bar.getAttribute(shape) == "square") // `shape` remains the same
The AntlrTask class now supports explicitly setting the target package for generated code when using Antlr 4. Previously, setting the "-package" argument also required setting the output directory in order to generate classes into the proper package-specific directory structure. This release introduces a packageName
property that allows you to set the target package without needing to also set the output directory properly. Setting this property will set the "-package" argument for the Antlr tool, and will also set the generated class directory to match the package.
Explicitly setting the "-package" argument is now deprecated, and will become an error in Gradle 10.
This option is not available for versions before Antlr 4 and will result in an error if this property is set.
tasks.named("generateGrammarSource").configure {
// Set the target package for generated code
packageName = "com.example.generated"
}
In previous versions of Gradle, the Antlr-generated sources were added to a java source set for compilation, but if the generated sources directory was changed, this change was not reflected in the source set. This required manually updating the source set to include the new generated sources directory any time it was changed. In this release, the generated sources directory is automatically tracked and updates the source set accordingly. A task dependency is also created between the source generation task and the source set, ensuring that tasks that consume the source set as an input will automatically create a task dependency on the source generation task.
Promoted features are features that were incubating in previous versions of Gradle but are now supported and subject to backward compatibility. See the User Manual section on the "Feature Lifecycle" for more information.
The following are the features that have been promoted in this Gradle release.
getDependencyFactory()
in Project
Known issues are problems that were discovered post-release that are directly related to changes made in this release.
We love getting contributions from the Gradle community. For information on contributing, please see gradle.org/contribute.
If you find a problem with this release, please file a bug on GitHub Issues adhering to our issue guidelines. If you're not sure if you're encountering a bug, please use the forum.
We hope you will build happiness with Gradle, and we look forward to your feedback via Twitter or on GitHub.