Gradle Release Notes

Version 8.0-milestone-5

The Gradle team is excited to announce Gradle 8.0-milestone-5.

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:

Andrei Nevedomskii, Björn Kautler, Clara Guerrero, David Marin, Denis Buzmakov, Dmitry Pogrebnoy, Dzmitry Neviadomski, Eliezer Graber, Fedor Ihnatkevich, Gabriel Rodriguez, Guruprasad Bagade, Herbert von Broeuschmeul, Matthew Haughton, Michael Torres, Pankaj Kumar, Ricardo Jiang, Siddardha Bezawada, Stephen Topley, Victor Maldonado, Vinay Potluri, Jeff Gaston, David Morris.

Table Of Contents

Upgrade instructions

Switch your build to use Gradle 8.0-milestone-5 by updating your wrapper:

./gradlew wrapper --gradle-version=8.0-milestone-5

See the Gradle 7.x upgrade guide to learn about deprecations, breaking changes and other considerations when upgrading to Gradle 8.0-milestone-5.

For Java, Groovy, Kotlin and Android compatibility, see the full compatibility notes.

New features and usability improvements

JVM

Introduced projectInternalView() dependency for test suites with access to project internals

The JVM test suite dependencies block now supports depending on the internal view of the current project at compile-time. Previously it was only possible to depend on the current project's API. This allows test suites to access project internals that are not declared on the api or compileOnlyApi configurations. This functionality can be useful when testing internal classes that use dependencies which are not exposed as part of a project's API, like those declared on the implementation and compileOnly configurations.

For example, the following snippet uses the new projectInternalView() API to define a test suite with access to project internals:

testing {
    suites {
        val unitLikeTestSuite by registering(JvmTestSuite::class) {
            useJUnitJupiter()
            dependencies {
                implementation(projectInternalView())
            }
        }
    }
}

For more information about warning modes, see JVM test suite.

Kotlin DSL

Gradle's Kotlin DSL provides an alternative syntax to the traditional Groovy DSL with an enhanced editing experience in supported IDEs, with superior content assist, refactoring, documentation, and more.

Updated the Kotlin DSL to Kotlin API Level 1.5

Previously, the Kotlin DSL used Kotlin API level 1.4. Starting with Gradle 8.0, the Kotlin DSL uses Kotlin API level 1.5. This change brings all the improvements made to the Kotlin language and standard library since Kotlin 1.4.0.

For information about breaking and nonbreaking changes in this upgrade, see the upgrading guide.

Enhanced script compilation to use the Gradle JVM as Kotlin JVM Target

Previously, the compilation of .gradle.kts scripts always used Java 8 as the Kotlin JVM target. Starting with Gradle 8.0, it now uses the version of the JVM running the build.

If your team is using e.g. Java 11 to run Gradle, this allows you to use Java 11 librairies and language features in your build scripts.

Note that this doesn't apply to precompiled script plugins which use the configured kotlinDslPluginOptions.jvmTarget.

Imporved Script compilation performance

This Gradle version introduces an interpreter for declarative plugins {} blocks in .gradle.kts scripts. It allows to avoid calling the Kotlin compiler for declarative plugins {} blocks and is enabled by default.

On a build with declarative plugins {} blocks, a Gradle invocation that needs to compile all scripts, the interpreter makes the overall build time around 20% faster. As usual, compiled scripts are stored in the build cache and can be reused by other builds.

Here is what is supported in declarative plugins {} blocks:

plugins {
    id("java-library")                               // <1>
    id("com.acme.example") version "1.0 apply false" // <2>
    kotlin("jvm") version "1.7.21"                   // <3>
}
  1. Plugin specification by plugin identifier string
  2. Plugin specification with version and/or the plugin application flag
  3. Kotlin plugin specification helper

Note that using version catalog aliases for plugins or plugin specification type-safe accessors is not supported by the plugins {} block interpreter.

Here are examples of unsupported constructs:

plugins {
    val v = "2"
    id("some") version v    // <1>

    `java-library`          // <2>
    alias(libs.plugins.jmh) // <3>
}
  1. Non-declarative code, unsupported
  2. Plugin specification type-safe accessor, unsupported
  3. Version catalog plugin reference, unsupported

In the cases above, Gradle falls back to the Kotlin compiler, providing the same performance as previous Gradle releases.

General Improvements

Enhanced warning modes all and fail are now more verbose

Warning modes that are supposed to print all warnings were printing only one for each specific warning message.

If there were two warnings with the same message, but originating from different steps of the build process (i.e. different stack traces), only one of them was printed.

Now one gets printed for each combination of message and stack trace.

For more information about warning modes, see Showing or hiding warnings.

Improved Dependency verification metadata

The following nodes with dependency verification metadata file verification-metadata.xml now support a reason attribute:

A reason is helpful to provide more details on why an artifact is trusted or why a selected checksum verification is required for an artifact directly in the verification-metadata.xml.

Improved Dependency verification CLI

You can now use the export-keys flag to export all already trusted keys:

./gradlew --export-keys

There is no longer a need to write verification metadata when exporting trusted keys.

For more information, see Exporting keys.

Dependency Management

Configuration Cache

Plugin Development

Enhanced CodeNarc Plugin to automatically detects appropriate version for current Groovy runtime

The CodeNarc project now publishes separate versions for use with Groovy 4. Gradle still currently ships with Groovy 3.

To ensure future compatibility, the CodeNarcPlugin now automatically detects the appropriate version of CodeNarc for the current Groovy runtime.

You can still explicitly specify a CodeNarc version with the toolVersion property on the CodeNarcExtension.

Enhanced PMD and CodeNarc tasks to execute in parallel by default

The PMD and CodeNarc plugins now use the Gradle worker API and JVM toolchains. These tools now perform analysis via an external worker process and therefore their tasks may now run in parallel within one project.

In Java projects, these tools will use the same version of Java required by the project. In other types of projects, they will use the same version of Java that is used by the Gradle daemon.

IDE Integration

Promoted features are features that were incubating in previous versions of Gradle but are now supported and subject to backwards 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.

The following type and method are now considered stable:

Fixed issues

Known issues

Known issues are problems that were discovered post release that are directly related to changes made in this release.

External contributions

We love getting contributions from the Gradle community. For information on contributing, please see gradle.org/contribute.

Reporting problems

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 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.