Declare the servlet API compileOnlyApi in grails-web-core and grails-mimetypes - #16360
Merged
Merged
Conversation
…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 #16356, which did the same for grails-converters.
sbglasius
approved these changes
Sep 21, 2026
jdaugherty
approved these changes
Sep 21, 2026
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 8.0.x #16360 +/- ##
==================================================
+ Coverage 56.1565% 56.1710% +0.0145%
- Complexity 21703 21705 +2
==================================================
Files 2124 2124
Lines 103078 103078
Branches 18447 18447
==================================================
+ Hits 57885 57900 +15
+ Misses 36922 36905 -17
- Partials 8271 8273 +2 🚀 New features to boost your workflow:
|
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.
Follow-up to #16356, as discussed in #16356 (comment).
grails-web-core(grails-web-servlets-module) andgrails-mimetypes(grails-mimetypes-module) both ship a Groovy extension module whose extension classes takeHttpServletRequest,HttpServletResponse,HttpSessionandServletContextin their signatures. The Groovy compiler loads extension modules from any compile classpath they are on, so a module that depends on either of them without the servlet API failscompileGroovywith the sameNoClassDefFoundErrorthat #16356 fixed forgrails-converters.Declare the servlet API
compileOnlyApiin both, matchinggrails-converters,grails-controllers,grails-web-gspandgrails-web-taglib.The runtime classpath is unchanged: in the generated Gradle module metadata
jakarta.servlet-apiappears onapiElementsonly, not onruntimeElements.