Skip to content
This repository was archived by the owner on Feb 21, 2025. It is now read-only.
This repository was archived by the owner on Feb 21, 2025. It is now read-only.

[FEATURE] Support running Gradle with JDK versions above Gradle's official support range #660

@JLLeitschuh

Description

@JLLeitschuh

Hear me out, this is currently already supported by Gradle, but this doesn't work when applying this action.

If you have a Gradle build that is entirely written in Kotlin, you can run that build on a JVM that is above the supported version range of Gradle.

For example, I currently have a Gradle build using Gradle 7.1.1 and 7.3.3 running on JDK 20, a version that Gradle 8.0 still doesn't officially support, but it's doing so without failure.

However, as soon as you apply this action, the JDK support is restricted to the range of versions that Gradle officially supports. That's because Gradle compiles groovy script files with the current JDK, which generates a class file with the JDK version header. Then when Gradle attempts to execute that file, it blows up, stating that class files of that version aren't supported.

The best way that this could be fixed by this plugin would be to either:

  1. Change the init scripts to use Kotlin instead of Groovy, which will compile to class files with lower bytecode compatibility
  2. Add support for an option to disable adding the init script to the environment.

That way, if you apply this plugin, you can still take advantage of the rest of the features, like the great caching support, but you can still run on much higher versions of the JDK than the version of Gradle being used supports.

When is this needed: primarily when developing Gradle plugins.

Show me an example

Gradle build runs fine on JDK 20, even though Gradle's official documentation states that no version of Gradle supports it.

Example of a build where applying this action breaks the build due to the class file incompatibility:

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions