8.0.0-SNAPSHOT grails-converters needs compileOnlyApi for jakarta.servlet-api - #16356
Merged
jdaugherty merged 2 commits intoSep 21, 2026
Merged
jdaugherty merged 2 commits into
jdaugherty merged 2 commits into
Conversation
ConvertersExtension is a Groovy extension module whose getJSON and getXML signatures take HttpServletRequest. The Groovy compiler loads every extension module it finds on a compile classpath before compiling anything, so any module that depends on grails-converters without a web starter on its classpath fails compileGroovy with General error during canonicalization: java.lang.NoClassDefFoundError: Unable to configure org.grails.web.converters.ConvertersExtension due to missing dependency jakarta/servlet/http/HttpServletRequest The servlet API was declared compileOnly, so consumers only compiled when something else happened to supply it. In a plugin build that something was usually grails-console, added to the compile classpath by the CLI companion probe; turning the probe off (grailsCliAutoProvision=false) exposed the missing declaration. compileOnlyApi puts the servlet API on consumers' compile classpaths while leaving the runtime classpath to the container, which is what grails-controllers, grails-web-gsp and grails-web-taglib already declare. The duplicate compileOnly line further down is dropped.
codeconsole
requested review from
borinquenkid,
jdaugherty,
matrei and
sbglasius
and removed request for
matrei
September 20, 2026 22:03
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 8.0.x #16356 +/- ##
==================================================
- Coverage 56.1295% 56.1169% -0.0126%
+ Complexity 21611 21610 -1
==================================================
Files 2123 2123
Lines 102887 102887
Branches 18396 18396
==================================================
- Hits 57750 57737 -13
- Misses 36893 36909 +16
+ Partials 8244 8241 -3 🚀 New features to boost your workflow:
|
🚨 All tests passed but jobs failed 🚨Failed Jobs without Test Failures❌ CI / Build Grails-Core (macOS JDK 21) 🏷️ Commit: 6a4e044 Learn more about TestLens at testlens.app/docs. |
matrei
approved these changes
Sep 21, 2026
matrei
left a comment
Contributor
There was a problem hiding this comment.
Should we do this for grails-web-core and grails-mimetypes as well for completeness?
sbglasius
approved these changes
Sep 21, 2026
Contributor
|
@matrei that's probably a good idea, i'd like to go ahead and merge this to get the RC1 milestone closer to getting done. Will you open a separate PR? |
Contributor
@jdaugherty Opened #16360 |
codeconsole
pushed a commit
to codeconsole/grails-core
that referenced
this pull request
Sep 21, 2026
…mimetypes Both modules ship a Groovy extension module with servlet types in its signatures. The Groovy compiler loads extension modules from any compile classpath they are on, so a consumer without the servlet API fails compileGroovy with a NoClassDefFoundError. Follow-up to apache#16356, which did the same for grails-converters.
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.
ConvertersExtensionis a Groovy extension module whosegetJSON/getXMLsignatures takeHttpServletRequest. The Groovy compiler loads extension modules from any compile classpath they are on, so a module that depends ongrails-converterswithout a web starter failscompileGroovy:Declare the servlet API
compileOnlyApi, asgrails-controllers,grails-web-gspandgrails-web-taglibalready do. Runtime classpath unchanged; the module metadata puts it onapiElementsonly.Note: #16237 moves
getXMLinto a newgrails-xmlwith acompileOnlyservlet declaration, which would need the same change.