Package org.gradle.jvm.toolchain

# Interface JavaToolchainService

@ServiceScope(org.gradle.internal.service.scopes.Scope.Project.class) public interface JavaToolchainService
Allows to query for toolchain managed tools, like `JavaCompiler`, `JavaLauncher` and `JavadocTool`.

An instance of this service is available for injection into tasks, plugins and other types.

Since:
  6.7

- ## Method Summary

  Modifier and Type
  Method
  Description
  `Provider<JavaCompiler>`
  `compilerFor(Action<? super JavaToolchainSpec> config)`
  Obtain a `JavaCompiler` matching the `JavaToolchainSpec`, as configured by the provided action.
  `Provider<JavaCompiler>`
  `compilerFor(JavaToolchainSpec spec)`
  Obtain a `JavaCompiler` matching the `JavaToolchainSpec`.
  `Provider<JavadocTool>`
  `javadocToolFor(Action<? super JavaToolchainSpec> config)`
  Obtain a `JavadocTool` matching the `JavaToolchainSpec`, as configured by the provided action.
  `Provider<JavadocTool>`
  `javadocToolFor(JavaToolchainSpec spec)`
  Obtain a `JavadocTool` matching the `JavaToolchainSpec`.
  `Provider<JavaLauncher>`
  `launcherFor(Action<? super JavaToolchainSpec> config)`
  Obtain a `JavaLauncher` matching the `JavaToolchainSpec`, as configured by the provided action.
  `Provider<JavaLauncher>`
  `launcherFor(JavaToolchainSpec spec)`
  Obtain a `JavaLauncher` matching the `JavaToolchainSpec`.

- ## Method Details

  - ### compilerFor

    Provider<JavaCompiler> compilerFor(Action<? super JavaToolchainSpec> config)
    Obtain a `JavaCompiler` matching the `JavaToolchainSpec`, as configured by the provided action.
    Parameters:
      `config` - The configuration of the `JavaToolchainSpec`
    Returns:
      A `Provider<JavaCompiler>`

  - ### compilerFor

    Provider<JavaCompiler> compilerFor(JavaToolchainSpec spec)
    Obtain a `JavaCompiler` matching the `JavaToolchainSpec`.
    Parameters:
      `spec` - The `JavaToolchainSpec`
    Returns:
      A `Provider<JavaCompiler>`

  - ### launcherFor

    Provider<JavaLauncher> launcherFor(Action<? super JavaToolchainSpec> config)
    Obtain a `JavaLauncher` matching the `JavaToolchainSpec`, as configured by the provided action.
    Parameters:
      `config` - The configuration of the `JavaToolchainSpec`
    Returns:
      A `Provider<JavaLauncher>`

  - ### launcherFor

    Provider<JavaLauncher> launcherFor(JavaToolchainSpec spec)
    Obtain a `JavaLauncher` matching the `JavaToolchainSpec`.
    Parameters:
      `spec` - The `JavaToolchainSpec`
    Returns:
      A `Provider<JavaLauncher>`

  - ### javadocToolFor

    Provider<JavadocTool> javadocToolFor(Action<? super JavaToolchainSpec> config)
    Obtain a `JavadocTool` matching the `JavaToolchainSpec`, as configured by the provided action.
    Parameters:
      `config` - The configuration of the `JavaToolchainSpec`
    Returns:
      A `Provider<JavadocTool>`

  - ### javadocToolFor

    Provider<JavadocTool> javadocToolFor(JavaToolchainSpec spec)
    Obtain a `JavadocTool` matching the `JavaToolchainSpec`.
    Parameters:
      `spec` - The `JavaToolchainSpec`
    Returns:
      A `Provider<JavadocTool>`