Repository navigation
Compile GSP pages with the Java the project asked for - #16118
Merged
codeconsole merged 1 commit intoAug 10, 2026
Merged
Conversation
Compiling pages is forked, and a forked process runs whatever JVM it is given.
Nothing gave it one, so it inherited the JVM running Gradle. A project that
declared a toolchain had its pages built by a different Java from everything
else it built.
Nothing failed while building. The mismatch surfaced the first time a page was
rendered, as
UnsupportedClassVersionError: gsp_appindex_gsp has been compiled by a more
recent version of the Java Runtime (class file version 70.0), this version
of the Java Runtime only recognizes class file versions up to 69.0
The launcher is nested rather than internal because the task is cacheable. The
Java that did the compiling is part of what the result is, and without saying so
an entry produced by one Java was handed to a build asking for another --
surviving a clean, which left the workaround of pointing JAVA_HOME at the
intended Java not working either.
What a page is compiled for now follows what it is compiled by, unless the build
set targetCompatibility for itself.
A project that asked for no toolchain is still built by the JVM running Gradle,
which is what pages fell back to before and remains the right answer when
nothing else was asked for.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 8.0.x #16118 +/- ##
==================================================
+ Coverage 52.3431% 52.4020% +0.0589%
- Complexity 18296 18309 +13
==================================================
Files 2036 2036
Lines 96347 96380 +33
Branches 16829 16837 +8
==================================================
+ Hits 50431 50505 +74
+ Misses 38492 38445 -47
- Partials 7424 7430 +6
🚀 New features to boost your workflow:
|
jdaugherty
approved these changes
Aug 10, 2026
matrei
approved these changes
Aug 10, 2026
codeconsole
added a commit
to codeconsole/grails-core
that referenced
this pull request
Aug 11, 2026
Two conflicts, both against apache#16118 "Compile GSP pages with the Java the project asked for", and both taken from each side rather than chosen between: the toolchain launcher and the scaffolded-view staging are independent of one another. GroovyPagePlugin resolves the launcher and stages the scaffolded views; both compileGroovyPages and compileWebappGroovyPages take the launcher as a convention, and compileGroovyPages still waits on stageGroovyPages where a project scaffolds. GroovyPageForkCompileTask keeps the launcher as a @nested input and this branch's @DisableCachingByDefault. Two comments said things the merge made untrue and now say what holds: - apache#16118 gave cacheability as the reason the launcher is nested. This branch makes the task uncacheable, but nesting still earns its place -- an uncacheable task is still up-to-date checked, and the Java is part of what the result is. - This branch said neither the Groovy nor the Java that compiled a page was described by the task's inputs. The Java now is. The Groovy still is not, because AbstractCompile does not track its own classpath, and that alone is what keeps the task uncacheable.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Compiling GSP pages is forked, and a forked process runs whatever JVM it is given. Nothing gave it one, so it inherited the JVM running Gradle — meaning a project that declared a Java toolchain had its pages built by a different Java from everything else it built.
Nothing failed while building. The mismatch surfaced the first time a page was rendered:
compileGroovyPagesnow takes its launcher from the project's toolchain, so pages are compiled by the same Java as the rest of the project:java { toolchain { languageVersion = JavaLanguageVersion.of(21) } }What a page is compiled for follows what it is compiled by, unless the build sets
targetCompatibilityitself, which still wins.The launcher is a
@Nestedinput rather than an internal detail because the task is cacheable. The Java that did the compiling is part of what the result is, and without declaring it a cache entry produced by one Java was handed to a build asking for another — which survived aclean, so the usual workaround of pointingJAVA_HOMEat the intended Java did not help either.Limitations
A project that declares no toolchain is still built by the JVM running Gradle. That is what compiling pages fell back to before and remains the right answer when nothing else was asked for, but it means a build relying on
JAVA_HOMEalone is unchanged by this.