# Upgrading your build from Gradle 8.x to the latest

version 8.2

This chapter provides the information you need to migrate your Gradle 8.x builds to the latest Gradle release. For migrating from Gradle 4.x, 5.x, 6.x, or 7.x, see the older migration guide first.

We recommend the following steps for all users:

1. Try running `gradle help --scan` and view the deprecations view of the generated build scan.

   This is so you can see any deprecation warnings that apply to your build.

   Alternatively, you could run `gradle help --warning-mode=all` to see the deprecations in the console, though it may not report as much detailed information.

2. Update your plugins.

   Some plugins will break with this new version of Gradle, for example because they use internal APIs that have been removed or changed. The previous step will help you identify potential problems by issuing deprecation warnings when a plugin does try to use a deprecated part of the API.

3. Run `gradle wrapper --gradle-version 8.2` to update the project to 8.2.

4. Try to run the project and debug any errors using the Troubleshooting Guide.

## Upgrading from 8.1 and earlier

### Potential breaking changes

#### Upgrade to Kotlin 1.8.20

The embedded Kotlin has been updated to Kotlin 1.8.20. For more information, see What’s new in Kotlin 1.8.20.

Note that there is a known issue with Kotlin compilation avoidance that can cause `OutOfMemory` exceptions in `compileKotlin` tasks if the compilation classpath contains very large JAR files. This applies to builds applying the Kotlin plugin v1.8.20 or the `kotlin-dsl` plugin.

You can work around it by disabling Kotlin compilation avoidance in your `gradle.properties` file:

    kotlin.incremental.useClasspathSnapshot=false

See KT-57757 for more information.

#### Upgrade to Groovy 3.0.17

Groovy has been updated to Groovy 3.0.17.

Since the previous version was 3.0.15, the 3.0.16 changes are also included.

#### Upgrade to Ant 1.10.13

Ant has been updated to Ant 1.10.13.

Since the previous version was 1.10.11, the 1.10.12 changes are also included.

#### Upgrade to CodeNarc 3.2.0

The default version of CodeNarc has been updated to CodeNarc 3.2.0.

#### Upgrade to PMD 6.55.0

PMD has been updated to PMD 6.55.0.

Since the previous version was 6.48.0, all changes since then are included.

#### Upgrade to JaCoCo 0.8.9

JaCoCo has been updated to 0.8.9.

#### Plugin compatibility changes

A plugin compiled with Gradle >= 8.2 that makes use of the Kotlin DSL functions `Project.the<T>()`, `Project.the(KClass)` or `Project.configure<T> {}` cannot run on Gradle ⇐ 6.1.

#### Deferred or avoided configuration of some tasks

When performing dependency resolution, Gradle creates an internal representation of the available Configurations. This requires inspecting all configurations and artifacts. Processing artifacts created by tasks causes those tasks to be realized and configured.

This internal representation is now created more lazily, which can change the order in which tasks are configured. Some tasks may never be configured.

This change may cause code paths that relied on a particular order to no longer function, such as conditionally adding attributes to a configuration based on the presence of certain attributes.

This impacted the bnd plugin and JUnit5 build.

We recommend not modifying domain objects (configurations, source sets, tasks, etc) from configuration blocks for other domain objects that may not be configured.

For example, avoid doing something like this:

        configurations {
            val myConfig = create("myConfig")
        }

        tasks.register("myTask") {
                // This is not safe, as the execution of this block may not occur, or may not occur in the order expected
              configurations["myConfig"].attributes {
                  attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage::class.java, Usage.JAVA_RUNTIME))
              }
        }

### Deprecations

#### `CompileOptions` method deprecations

The following methods on `CompileOptions` are deprecated:

- `getAnnotationProcessorGeneratedSourcesDirectory()`

- `setAnnotationProcessorGeneratedSourcesDirectory(File)`

- `setAnnotationProcessorGeneratedSourcesDirectory(Provider<File>)`

Current usages of these methods should migrate to `DirectoryProperty getGeneratedSourceOutputDirectory()`

#### Using configurations incorrectly

Gradle will now warn at runtime when methods of Configuration are called inconsistently with the configuration’s intended usage.

This change is part of a larger ongoing effort to make the intended behavior of configurations more consistent and predictable, and to unlock further speed and memory improvements.

Currently, the following methods should only be called with these listed allowed usages:

- `resolve()` - RESOLVABLE configurations only

- `files(Closure)`, `files(Spec)`, `files(Dependency…)`, `fileCollection(Spec)`, `fileCollection(Closure)`, `fileCollection(Dependency…)` - RESOLVABLE configurations only

- `getResolvedConfigurations()` - RESOLVABLE configurations only

- `defaultDependencies(Action)` - DECLARABLE configurations only

- `shouldResolveConsistentlyWith(Configuration)` - RESOLVABLE configurations only

- `disableConsistentResolution()` - RESOLVABLE configurations only

- `getDependencyConstraints()` - DECLARABLE configurations only

- `copy()`, `copy(Spec)`, `copy(Closure)`, `copyRecursive()`, `copyRecursive(Spec)`, `copyRecursive(Closure)` - RESOLVABLE configurations only

Intended usage is noted in the `Configuration` interface’s Javadoc. This list is likely to grow in future releases.

Starting in Gradle 9.0, using a configuration inconsistently with its intended usage will be prohibited.

Also note that although it is not currently restricted, the `getDependencies()` method is really only intended for use with DECLARABLE configurations. The `getAllDependencies()` method, which retrieves all declared dependencies on a configuration and any superconfigurations, will not be restricted to any particular usage.

#### Deprecated access to plugin conventions

The concept of conventions is outdated and superseded by extensions to provide custom DSLs.

To reflect this in the Gradle API, the following elements are deprecated:

- org.gradle.api.Project.getConvention()

- org.gradle.api.plugins.Convention

- `org.gradle.api.internal.HasConvention`

Gradle Core plugins still register their conventions in addition to their extensions for backwards compatibility.

It is deprecated to access any of these conventions and their properties. Doing so will now emit a deprecation warning. This will become an error in Gradle 9.0. You should prefer accessing the extensions and their properties instead.

For specific examples see the next sections.

Prominent community plugins already migrated to using extensions to provide custom DSLs. Some of them still registers conventions for backwards compatibility. Registering conventions does not emit a deprecation warning yet to provide a migration window. Future Gradle versions will do.

Also note that Plugins compiled with Gradle ⇐ 8.1 that make use of the Kotlin DSL functions `Project.the<T>()`, `Project.the(KClass)` or `Project.configure<T> {}` will emit a deprecation warning when run on Gradle >= 8.2. To fix this these plugins should be recompiled with Gradle >= 8.2 or changed to access extensions directly using `extensions.getByType<T>()` instead.

#### Deprecated `base` plugin conventions

The convention properties contributed by the `base` plugin have been deprecated and scheduled for removal in Gradle 9.0. For the wider context see the section about plugin convention deprecation.

The conventions are replaced by the `base { }` configuration block backed by BasePluginExtension. The old convention object defines the `distsDirName`, `libsDirName` and `archivesBaseName` properties with simple getter and setter methods. Those methods are available in the extension only to maintain backwards compatibility. Build scripts should solely use the properties of type `Property`:

build.gradle.kts

    plugins {
        base
    }

    base {
        archivesName.set("gradle")
        distsDirectory.set(layout.buildDirectory.dir("custom-dist"))
        libsDirectory.set(layout.buildDirectory.dir("custom-libs"))
    }

build.gradle

    plugins {
        id 'base'
    }

    base {
        archivesName = "gradle"
        distsDirectory = layout.buildDirectory.dir('custom-dist')
        libsDirectory = layout.buildDirectory.dir('custom-libs')
    }

#### Deprecated `application` plugin conventions

The convention properties contributed by the `application` plugin have been deprecated and scheduled for removal in Gradle 9.0. For the wider context see the section about plugin convention deprecation.

The following code will now emit deprecation warnings:

build.gradle.kts

    plugins {
        application
    }

    applicationDefaultJvmArgs = listOf("-Dgreeting.language=en") // Accessing a convention

build.gradle

    plugins {
        id 'application'
    }

    applicationDefaultJvmArgs = ['-Dgreeting.language=en'] // Accessing a convention

This should be changed to use the `application { }` configuration block, backed by JavaApplication, instead:

build.gradle.kts

    plugins {
        application
    }

    application {
        applicationDefaultJvmArgs = listOf("-Dgreeting.language=en")
    }

build.gradle

    plugins {
        id 'application'
    }

    application {
        applicationDefaultJvmArgs = ['-Dgreeting.language=en']
    }

#### Deprecated `java` plugin conventions

The convention properties contributed by the `java` plugin have been deprecated and scheduled for removal in Gradle 9.0. For the wider context see the section about plugin convention deprecation.

The following code will now emit deprecation warnings:

build.gradle.kts

    plugins {
        id("java")
    }

    configure<JavaPluginConvention> { // Accessing a convention
        sourceCompatibility = JavaVersion.VERSION_18
    }

build.gradle

    plugins {
        id 'java'
    }

    sourceCompatibility = 18 // Accessing a convention

This should be changed to use the `java { }` configuration block, backed by JavaPluginExtension, instead:

build.gradle.kts

    plugins {
        id("java")
    }

    java {
        sourceCompatibility = JavaVersion.VERSION_18
    }

build.gradle

    plugins {
        id 'java'
    }

    java {
        sourceCompatibility = JavaVersion.VERSION_18
    }

#### Deprecated `war` plugin conventions

The convention properties contributed by the `war` plugin have been deprecated and scheduled for removal in Gradle 9.0. For the wider context see the section about plugin convention deprecation.

The following code will now emit deprecation warnings:

build.gradle.kts

    plugins {
        id("war")
    }

    configure<WarPluginConvention> { // Accessing a convention
        webAppDirName = "src/main/webapp"
    }

build.gradle

    plugins {
        id 'war'
    }

    webAppDirName = 'src/main/webapp' // Accessing a convention

Clients should configure the `war` task directly. Also, tasks.withType(War.class).configureEach(…​) can be used to configure each task of type `War`.

build.gradle.kts

    plugins {
        id("war")
    }

    tasks.war {
        webAppDirectory.set(file("src/main/webapp"))
    }

build.gradle

    plugins {
        id 'war'
    }

    war {
        webAppDirectory = file('src/main/webapp')
    }

#### Deprecated `ear` plugin conventions

The convention properties contributed by the `ear` plugin have been deprecated and scheduled for removal in Gradle 9.0. For the wider context see the section about plugin convention deprecation.

The following code will now emit deprecation warnings:

build.gradle.kts

    plugins {
        id("ear")
    }

    configure<EarPluginConvention> { // Accessing a convention
        appDirName = "src/main/app"
    }

build.gradle

    plugins {
        id 'ear'
    }

    appDirName = 'src/main/app' // Accessing a convention

Clients should configure the `ear` task directly. Also, tasks.withType(Ear.class).configureEach(…​) can be used to configure each task of type `Ear`.

build.gradle.kts

    plugins {
        id("ear")
    }

    tasks.ear {
        appDirectory.set(file("src/main/app"))
    }

build.gradle

    plugins {
        id 'ear'
    }

    ear {
        appDirectory = file('src/main/app')  // use application metadata found in this folder
    }

#### Deprecated `project-report` plugin conventions

The convention properties contributed by the `project-reports` plugin have been deprecated and scheduled for removal in Gradle 9.0. For the wider context see the section about plugin convention deprecation.

The following code will now emit deprecation warnings:

build.gradle.kts

    plugins {
        `project-report`
    }

    configure<ProjectReportsPluginConvention> {
        projectReportDirName = "custom" // Accessing a convention
    }

build.gradle

    plugins {
        id 'project-report'
    }

    projectReportDirName = "custom" // Accessing a convention

Configure your report task instead:

build.gradle.kts

    plugins {
        `project-report`
    }

    tasks.withType<HtmlDependencyReportTask>() {
        projectReportDirectory.set(project.layout.buildDirectory.dir("reports/custom"))
    }

build.gradle

    plugins {
        id 'project-report'
    }

    tasks.withType(HtmlDependencyReportTask) {
        projectReportDirectory = project.layout.buildDirectory.dir("reports/custom")
    }

#### Redundant configuration usage activation

Calling `setCanBeConsumed(boolean)` or `setCanBeResolved(boolean)` on a configuration that already allows that usage is deprecated.

This deprecation is intended to help users identify unnecessary configuration usage modifications.

#### `Configuration` method deprecations

The following method on `Configuration` is deprecated for removal:

- `getAll()`

Obtain the set of all configurations from the project’s `configurations` container instead.

#### Relying on automatic test framework implementation dependencies

In some cases, Gradle will load JVM test framework dependencies from the Gradle distribution in order to execute tests. This existing behavior can lead to test framework dependency version conflicts on the test classpath. To avoid these conflicts, this behavior is deprecated and will be removed in Gradle 9.0. Tests using TestNG are unaffected.

In order to prepare for this change in behavior, either declare the required dependencies explicitly, or migrate to Test Suites, where these dependencies are managed automatically.

##### Test Suites

Builds that use test suites will not be affected by this change. Test suites manage the test framework dependencies automatically and do not require dependencies to be explicitly declared. See the user manual for further information on migrating to test suites.

##### Manually declaring dependencies

In the absence of test suites, dependencies must be manually declared on the test runtime classpath:

- If using JUnit 5, an explicit `runtimeOnly` dependency on `junit-platform-launcher` is required in addition to the existing `implementation` dependency on the test engine.

- If using JUnit 4, only the existing `implementation` dependency on `junit` 4 is required.

- If using JUnit 3, a test `runtimeOnly` dependency on `junit` 4 is required in addition to a `compileOnly` dependency on `junit` 3.

build.gradle.kts

    dependencies {
        // If using JUnit Jupiter
        testImplementation("org.junit.jupiter:junit-jupiter:5.9.2")
        testRuntimeOnly("org.junit.platform:junit-platform-launcher")

        // If using JUnit Vintage
        testCompileOnly("junit:junit:4.13.2")
        testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.9.2")
        testRuntimeOnly("org.junit.platform:junit-platform-launcher")

        // If using JUnit 4
        testImplementation("junit:junit:4.13.2")

        // If using JUnit 3
        testCompileOnly("junit:junit:3.8.2")
        testRuntimeOnly("junit:junit:4.13.2")
    }

build.gradle

    dependencies {
        // If using JUnit Jupiter
        testImplementation("org.junit.jupiter:junit-jupiter:5.9.2")
        testRuntimeOnly("org.junit.platform:junit-platform-launcher")

        // If using JUnit Vintage
        testCompileOnly("junit:junit:4.13.2")
        testRuntimeOnly("org.junit.vintage:junit-vintage-engine:5.9.2")
        testRuntimeOnly("org.junit.platform:junit-platform-launcher")

        // If using JUnit 4
        testImplementation("junit:junit:4.13.2")

        // If using JUnit 3
        testCompileOnly("junit:junit:3.8.2")
        testRuntimeOnly("junit:junit:4.13.2")
    }

#### `BuildIdentifier` and `ProjectComponentSelector` method deprecations

The following methods on `BuildIdentifier` are deprecated:

- `getName()`

- `isCurrentBuild()`

You could use these methods to distinguish between different project components with the same name but from different builds. However, for certain composite build setups, these methods do not provide enough information to guarantee uniqueness.

Current usages of these methods should migrate to `BuildIdentifier.getBuildPath()`.

Similarly, the method `ProjectComponentSelector.getBuildName()` is deprecated. Use `ProjectComponentSelector.getBuildPath()` instead.

## Upgrading from 8.0 and earlier

### CACHEDIR.TAG files are created in global cache directories

Gradle now emits a `CACHEDIR.TAG` file in some global cache directories, as specified in directory_layout.html.

This may cause these directories to no longer be searched or backed up by some tools. To disable it, use the following code in an init script in the Gradle User Home:

init.gradle.kts

    beforeSettings {
        caches {
            // Disable cache marking for all caches
            markingStrategy.set(MarkingStrategy.NONE)
        }
    }

init.gradle

    beforeSettings { settings ->
        settings.caches {
            // Disable cache marking for all caches
            markingStrategy = MarkingStrategy.NONE
        }
    }

### Configuration cache options renamed

In this release, the configuration cache feature was promoted from incubating to stable, and as such, all properties originally mentioned in the feature documentation (which had an `unsafe` part in their names, e.g. `org.gradle.unsafe.configuration-cache`) were renamed, in some cases, by just removing the `unsafe` bit.

Incubating property | Finalized property
--- | ---
`org.gradle.unsafe.configuration-cache` | `org.gradle.configuration-cache`
`org.gradle.unsafe.configuration-cache-problems` | `org.gradle.configuration-cache.problems`*
`org.gradle.unsafe.configuration-cache.max-problems` | `org.gradle.configuration-cache.max-problems`

Note that the original `org.gradle.unsafe.configuration-cache…​` properties continue to be honored in this release, and no warnings will be produced if they are used, but they will be deprecated and removed in a future release.

### Potential breaking changes

#### Kotlin DSL scripts emit compilation warnings

Compilation warnings from Kotlin DSL scripts are printed to the console output. For example, the use of deprecated APIs in Kotlin DSL will emit warnings each time the script is compiled.

This is a potentially breaking change if you are consuming the console output of Gradle builds.

#### Configuring Kotlin compiler options with the `kotlin-dsl` plugin applied

If you are configuring custom Kotlin compiler options on a project with the kotlin-dsl plugin applied you might encounter a breaking change.

In previous Gradle versions, the `kotlin-dsl` plugin was adding required compiler arguments on afterEvaluate {}. Now that the Kotlin Gradle Plugin provides lazy configuration properties, our `kotlin-dsl` plugin switched to adding required compiler arguments to the lazy properties directly. As a consequence, if you were setting `freeCompilerArgs` the `kotlin-dsl` plugin is now failing the build because its required compiler arguments are overridden by your configuration.

build.gradle.kts

    plugins {
        `kotlin-dsl`
    }

    tasks.withType(KotlinCompile::class).configureEach {
        kotlinOptions { // Deprecated non-lazy configuration options
            freeCompilerArgs = listOf("-Xcontext-receivers")
        }
    }

With the configuration above you would get the following build failure:

    * What went wrong
    Execution failed for task ':compileKotlin'.
    > Kotlin compiler arguments of task ':compileKotlin' do not work for the `kotlin-dsl` plugin. The 'freeCompilerArgs' property has been reassigned. It must instead be appended to. Please use 'freeCompilerArgs.addAll(\"your\", \"args\")' to fix this.

You must change this to adding your custom compiler arguments to the lazy configuration properties of the Kotlin Gradle Plugin in order for them to be appended to the ones required by the `kotlin-dsl` plugin:

build.gradle.kts

    plugins {
        `kotlin-dsl`
    }

    tasks.withType(KotlinCompile::class).configureEach {
        compilerOptions { // New lazy configuration options
            freeCompilerArgs.addAll("-Xcontext-receivers")
        }
    }

If you were already adding to `freeCompilerArgs` instead of setting its value, then you should not experience a build failure.

#### New API introduced may clash with existing Gradle DSL code

When a new property or method is added to an existing type in the Gradle DSL, it may clash with names already in use in user code.

When a name clash occurs, one solution is to rename the element in user code.

This is a non-exhaustive list of API additions in 8.1 that may cause name collisions with existing user code.

- `JavaExec.getJvmArguments()`

- `JavaExecSpec.getJvmArguments()`

#### Using unsupported API to start external processes at configuration time is no longer allowed with the configuration cache enabled

Since Gradle 7.5, using `Project.exec`, `Project.javaexec`, and standard Java and Groovy APIs to run external processes at configuration time has been considered an error only if the feature preview `STABLE_CONFIGURATION_CACHE` was enabled. With the configuration cache promotion to a stable feature in Gradle 8.1, this error is detected regardless of the feature preview status. The configuration cache chapter has more details to help with the migration to the new provider-based APIs to execute external processes at configuration time.

Builds that do not use the configuration cache, or only start external processes at execution time are not affected by this change.

### Deprecations

#### Mutating core plugin configuration usage

The allowed usage of a configuration should be immutable after creation. Mutating the allowed usage on a configuration created by a Gradle core plugin is deprecated. This includes calling any of the following `Configuration` methods:

- `setCanBeConsumed(boolean)`

- `setCanBeResolved(boolean)`

These methods now emit deprecation warnings on these configurations, except for certain special cases which make allowances for the existing behavior of popular plugins. This rule does not yet apply to detached configurations or configurations created in buildscripts and third-party plugins. Calling `setCanBeConsumed(false)` on `apiElements` or `runtimeElements` is not yet deprecated in order to avoid warnings that would be otherwise emitted when using select popular third-party plugins.

This change is part of a larger ongoing effort to make the intended behavior of configurations more consistent and predictable, and to unlock further speed and memory improvements in this area of Gradle.

The ability to change the allowed usage of a configuration after creation will be removed in Gradle 9.0.

#### Reserved configuration names

Configuration names "detachedConfiguration" and "detachedConfigurationX" (where X is any integer) are reserved for internal use when creating detached configurations.

The ability to create non-detached configurations with these names will be removed in Gradle 9.0.

#### Calling select methods on the `JavaPluginExtension` without the `java` component present

Starting in Gradle 8.1, calling any of the following methods on `JavaPluginExtension` without the presence of the default `java` component is deprecated:

- `withJavadocJar()`

- `withSourcesJar()`

- `consistentResolution(Action)`

This `java` component is added by the `JavaPlugin`, which is applied by any of the Gradle JVM plugins including:

- `java-library`

- `application`

- `groovy`

- `scala`

Starting in Gradle 9.0, calling any of the above listed methods without the presence of the default `java` component will become an error.

#### `WarPlugin#configureConfiguration(ConfigurationContainer)`

Starting in Gradle 8.1, calling `WarPlugin#configureConfiguration(ConfigurationContainer)` is deprecated. This method was intended for internal use and was never intended to be used as part of the public interface.

Starting in Gradle 9.0, this method will be removed without replacement.

#### Relying on conventions for custom Test tasks

By default, when applying the `java` plugin, the `testClassesDirs` and `classpath` of all `Test` tasks have the same convention. Unless otherwise changed, the default behavior is to execute the tests from the default `test` `TestSuite` by configuring the task with the `classpath` and `testClassesDirs` from the `test` suite. This behavior will be removed in Gradle 9.0.

While this existing default behavior is correct for the use case of executing the default unit test suite under a different environment, it does not support the use case of executing an entirely separate set of tests.

If you wish to continue including these tests, use the following code to avoid the deprecation warning in 8.1 and prepare for the behavior change in 9.0. Alternatively, consider migrating to test suites.

build.gradle.kts

    val test by testing.suites.existing(JvmTestSuite::class)
    tasks.named<Test>("myTestTask") {
        testClassesDirs = files(test.map { it.sources.output.classesDirs })
        classpath = files(test.map { it.sources.runtimeClasspath })
    }

build.gradle

    tasks.myTestTask {
        testClassesDirs = testing.suites.test.sources.output.classesDirs
        classpath = testing.suites.test.sources.runtimeClasspath
    }

#### Modifying Gradle Module Metadata after a publication has been populated

Altering the GMM (e.g., changing a component configuration variants) after a Maven or Ivy publication has been populated from their components is now deprecated. This feature will be removed in Gradle 9.0.

Eager population of the publication can happen if the following methods are called:

- Maven

  - MavenPublication.getArtifacts()

- Ivy

  - IvyPublication.getArtifacts()

  - IvyPublication.getConfigurations()

  - IvyPublication.configurations(Action)

Previously, the following code did not generate warnings, but it created inconsistencies between published artifacts:

build.gradle.kts

    publishing {
        publications {
            create<MavenPublication>("maven") {
                from(components["java"])
            }
            create<IvyPublication>("ivy") {
                from(components["java"])
            }
        }
    }

    // These calls eagerly populate the Maven and Ivy publications

    (publishing.publications["maven"] as MavenPublication).artifacts
    (publishing.publications["ivy"] as IvyPublication).artifacts

    val javaComponent = components["java"] as AdhocComponentWithVariants
    javaComponent.withVariantsFromConfiguration(configurations["apiElements"]) { skip() }
    javaComponent.withVariantsFromConfiguration(configurations["runtimeElements"]) { skip() }

build.gradle

    publishing {
        publications {
            maven(MavenPublication) {
                from components.java
            }
            ivy(IvyPublication) {
                from components.java
            }
        }
    }

    // These calls eagerly populate the Maven and Ivy publications

    publishing.publications.maven.artifacts
    publishing.publications.ivy.artifacts

    components.java.withVariantsFromConfiguration(configurations.apiElements) { skip() }
    components.java.withVariantsFromConfiguration(configurations.runtimeElements) { skip() }

In this example, the Maven and Ivy publications will contain the main JAR artifacts for the project, whereas the GMM module file will omit them.

#### Running tests on JVM versions 6 and 7

Running JVM tests on JVM versions older than 8 is deprecated. Testing on these versions will become an error in Gradle 9.0

#### Applying Kotlin DSL precompiled scripts published with Gradle < 6.0

Applying Kotlin DSL precompiled scripts published with Gradle < 6.0 is deprecated. Please use a version of the plugin published with Gradle >= 6.0.

#### Applying the `kotlin-dsl` together with Kotlin Gradle Plugin < 1.8.0

Applying the `kotlin-dsl` together with Kotlin Gradle Plugin < 1.8.0 is deprecated. Please let Gradle control the version of `kotlin-dsl` by removing any explicit `kotlin-dsl` version constraints from your build logic. This will let the `kotlin-dsl` plugin decide which version of the Kotlin Gradle Plugin to use. If you explicitly declare which version of the Kotlin Gradle Plugin to use for your build logic, update it to >= 1.8.0.

#### Accessing `libraries` or `bundles` from dependency version catalogs in the `plugins {}` block of a Kotlin script

Accessing `libraries` or `bundles` from dependency version catalogs in the `plugins {}` block of a Kotlin script is deprecated. Please only use `versions` or `plugins` from dependency version catalogs in the `plugins {}` block.

#### Using `ValidatePlugins` task without a Java Toolchain

Using a task of type ValidatePlugins without applying the Java Toolchains plugin is deprecated, and will become an error in Gradle 9.0.

To avoid this warning, please apply the plugin to your project:

build.gradle.kts

    plugins {
        id("jdk-toolchains")
    }

build.gradle

    plugins {
        id 'jdk-toolchains'
    }

The Java Toolchains plugin is applied automatically by the Java plugin, so you can also apply it to your project and it will fix the warning.

#### Deprecated members of the `org.gradle.util` package now report their deprecation

These members will be removed in Gradle 9.0.

- `WrapUtil.toDomainObjectSet(…​)`

- `GUtil.toCamelCase(…​)`

- `GUtil.toLowerCase(…​)`

- `ConfigureUtil`

#### Deprecated JVM vendor IBM Semeru

The enum constant `JvmVendorSpec.IBM_SEMERU` is now deprecated and will be removed in Gradle 9.0.

Please replace it by its equivalent `JvmVendorSpec.IBM` to avoid warnings and potential errors in the next major version release.

#### Setting custom build layout on `StartParameter` and `GradleBuild`

Following the related previous deprecation of the behaviour in Gradle 7.1, it is now also deprecated to use related StartParameter and GradleBuild properties. These properties will be removed in Gradle 9.0.

Setting custom build file using buildFile property in GradleBuild task has been deprecated.

Please use the dir property instead to specify the root of the nested build. Alternatively, consider using one of the recommended alternatives for GradleBuild task as suggested in Avoid using the GradleBuild task type section.

Setting custom build layout using StartParameter methods setBuildFile(File) and setSettingsFile(File) as well as the counterpart getters getBuildFile() and getSettingsFile() have been deprecated.

Please use standard locations for settings and build files:

- settings file in the root of the build

- build file in the root of each subproject

#### Deprecated org.gradle.cache.cleanup property

The `org.gradle.cache.cleanup` property in `gradle.properties` under Gradle User Home has been deprecated. Please use the cache cleanup DSL instead to disable or modify the cleanup configuration.

Since the `org.gradle.cache.cleanup` property may still be needed for older versions of Gradle, this property may still be present and no deprecation warnings will be printed as long as it is also configured via the DSL. The DSL value will always take preference over the `org.gradle.cache.cleanup` property. If the desired configuration is to disable cleanup for older versions of Gradle (using `org.gradle.cache.cleanup`), but to enable cleanup with the default values for Gradle versions at or above Gradle 8, then cleanup should be configured to use Cleanup.DEFAULT:

cache-settings.gradle

    if (GradleVersion.current() >= GradleVersion.version('8.0')) {
        apply from: "gradle8/cache-settings.gradle"
    }

cache-settings.gradle.kts

    if (GradleVersion.current() >= GradleVersion.version("8.0")) {
        apply(from = "gradle8/cache-settings.gradle")
    }

gradle8/cache-settings.gradle

    beforeSettings { settings ->
        settings.caches {
            cleanup = Cleanup.DEFAULT
        }
    }

gradle8/cache-settings.gradle.kts

    beforeSettings {
        caches {
            cleanup.set(Cleanup.DEFAULT)
        }
    }

#### Deprecated using relative paths to specify Java executables

Using relative file paths to point to Java executables is now deprecated and will become an error in Gradle 9. This is done to reduce confusion about what such relative paths should resolve against.

#### Calling `Task.getConvention()`, `Task.getExtensions()` from a task action

Calling Task.getConvention(), Task.getExtensions() from a task action at execution time is now deprecated and will be made an error in Gradle 9.0.

See the configuration cache chapter for details on how to migrate these usages to APIs that are supported by the configuration cache.

### Changes in the IDE integration

#### Workaround for false positive errors shown in Kotlin DSL `plugins {}` block using version catalog is not needed anymore

Version catalog accessors for plugin aliases in the `plugins {}` block aren’t shown as errors in IntelliJ IDEA and Android Studio Kotlin script editor anymore.

If you were using the `@Suppress("DSL_SCOPE_VIOLATION")` annotation as a workaround, you can now remove it.

If you were using the Gradle Libs Error Suppressor IntelliJ IDEA plugin, you can now uninstall it.

After upgrading Gradle to 8.1 you will need to clear the IDE caches and restart.

Also see the deprecated usages of version catalogs in the Kotlin DSL `plugins {}` block above.