# The JVM Toolchains Plugins

version 9.8.0-20260808003228+0000

Two related core plugins provide Java toolchain support: `jvm-toolchains` works at the project level, and `jvm-toolchain-management` works at the settings level. Both are applied automatically in the situations described below, so you rarely apply them by hand.

For the concepts — how a toolchain is selected, provisioned, and used by JVM tasks — see Toolchains for JVM projects. For writing and registering toolchain download repositories, see Toolchain Resolver Plugins.

## The `jvm-toolchains` plugin

The `jvm-toolchains` plugin (a `Plugin<Project>`) makes the JavaToolchainService available to a project so that toolchains can be selected and provisioned for JVM tools such as compilation, testing, and execution.

It adds the following extension:

`javaToolchains` — JavaToolchainService

  Used to query for and provision toolchains — for example, to obtain a `JavaLauncher`, `JavaCompiler`, or `JavadocTool` for a specific `JavaLanguageVersion`.

The JVM language plugins (via the `java-base` plugin) apply `jvm-toolchains` automatically, so most builds never apply it directly. Apply it explicitly only when you need the `javaToolchains` service in a project that does not apply a JVM language plugin:

build.gradle.kts

    plugins {
        id("jvm-toolchains")
    }

build.gradle

    plugins {
        id 'jvm-toolchains'
    }

## The `jvm-toolchain-management` plugin

The `jvm-toolchain-management` plugin (a `Plugin<Settings>`) adds a `jvm` block to the settings-level `toolchainManagement` container, where Java toolchain download repositories are configured:

settings.gradle.kts

    toolchainManagement {
        jvm {
            javaRepositories {
                // register toolchain resolver repositories here
            }
        }
    }

Toolchain resolver plugins apply `jvm-toolchain-management` automatically, so you normally do not apply it yourself.

## See also

- Toolchains for JVM projects — selecting and provisioning toolchains.

- Toolchain Resolver Plugins — writing and registering toolchain download repositories.