Interface JavaToolchainVersions

  • All Known Implementing Classes:
    JavaToolchainVersionsImpl

    public interface JavaToolchainVersions
    Options configuring Java toolchain versioning.
    Since:
    1.1.0
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      @NotNull org.gradle.api.provider.Provider<Integer> actualVersion()
      The version that should be used to run compile tasks, taking into account strict version and current JVM.
      @NotNull org.gradle.api.provider.Property<Integer> minimumToolchain()
      The minimum toolchain version to use when building.
      void minimumToolchain​(int minimumToolchain)
      Sets the minimum toolchain version.
      @NotNull org.gradle.api.provider.Property<Boolean> previewFeaturesEnabled()
      Whether to enable Java preview features on compile, test, and execution tasks.
      void previewFeaturesEnabled​(boolean previewFeaturesEnabled)
      Set whether Java preview features are enabled on compile, test, and execution tasks.
      @NotNull org.gradle.api.provider.Property<Boolean> strictVersions()
      Whether to strictly apply toolchain versions.
      void strictVersions​(boolean strictVersions)  
      @NotNull org.gradle.api.provider.Property<Integer> target()
      The target Java version to compile for.
      void target​(int target)
      Set the target to compile Java for.
      @NotNull org.gradle.api.provider.SetProperty<Integer> testWith()
      Toolchains that should be used to execute tests when strict versions are enabled.
      void testWith​(int... testVersions)
      Add alternate versions that should be tested with, when strict versions are enabled.
    • Method Detail

      • target

        @NotNull
        @NotNull org.gradle.api.provider.Property<Integer> target()
        The target Java version to compile for.

        Default: 8

        Returns:
        a property providing the target version
        Since:
        1.1.1
      • target

        void target​(int target)
        Set the target to compile Java for.
        Parameters:
        target - the java compile target
        Since:
        2.0.0
      • minimumToolchain

        @NotNull
        @NotNull org.gradle.api.provider.Property<Integer> minimumToolchain()
        The minimum toolchain version to use when building.

        Default: 11

        Returns:
        a property providing the minimum toolchain version
      • minimumToolchain

        void minimumToolchain​(int minimumToolchain)
        Sets the minimum toolchain version.
        Parameters:
        minimumToolchain - the minimum toolchain version
      • strictVersions

        @NotNull
        @NotNull org.gradle.api.provider.Property<Boolean> strictVersions()
        Whether to strictly apply toolchain versions.

        If this is set to false, java toolchains will only be overridden for the Gradle JVM's version is less than the target version, and cross-version testing will not be performed.

        Default: false unless the CI environment variable or strictMultireleaseVersions gradle property are set.

        Returns:
        whether strict versions are enabled
        Since:
        2.0.0
      • strictVersions

        void strictVersions​(boolean strictVersions)
      • testWith

        @NotNull
        @NotNull org.gradle.api.provider.SetProperty<Integer> testWith()
        Toolchains that should be used to execute tests when strict versions are enabled.
        Returns:
        a property containing the versions to test with
        Since:
        2.0.0
      • testWith

        void testWith​(int... testVersions)
        Add alternate versions that should be tested with, when strict versions are enabled.
        Parameters:
        testVersions - versions to test with
        Since:
        2.0.0
      • previewFeaturesEnabled

        @NotNull
        @NotNull org.gradle.api.provider.Property<Boolean> previewFeaturesEnabled()
        Whether to enable Java preview features on compile, test, and execution tasks.
        Returns:
        a property providing preview feature enabled state
        Since:
        2.0.0
      • previewFeaturesEnabled

        void previewFeaturesEnabled​(boolean previewFeaturesEnabled)
        Set whether Java preview features are enabled on compile, test, and execution tasks.
        Parameters:
        previewFeaturesEnabled - whether to enable preview features
        Since:
        2.0.0
      • actualVersion

        @NotNull
        @NotNull org.gradle.api.provider.Provider<Integer> actualVersion()
        The version that should be used to run compile tasks, taking into account strict version and current JVM.
        Returns:
        a provider resolving the actual Java toolchain version to use