jamesfredley opened a new pull request, #15392:
URL: https://github.com/apache/grails-core/pull/15392

   ## Summary
   
   - Fix `NoClassDefFoundError` for `jakarta/servlet/ServletRequest` when 
`grailsw` compiles custom scripts in `src/main/scripts/`
   
   ## Problem
   
   The `grails-cli` shadow JAR bundles `grails-web-common` (which registers 
`HttpServletRequestExtension` as a Groovy extension module), but 
`jakarta.servlet-api` is declared as `compileOnly` in `grails-shell-cli`. This 
means the servlet API classes are excluded from the fat JAR.
   
   When the CLI's `GroovyScriptCommandFactory` compiles custom command scripts, 
the Groovy compiler auto-discovers the `HttpServletRequestExtension` from the 
fat JAR's classpath. Initializing this extension requires 
`jakarta.servlet.ServletRequest`, which is missing — causing all `grailsw` 
commands to fail when custom scripts exist in `src/main/scripts/`.
   
   ## Fix
   
   Change `jakarta.servlet-api` from `compileOnly` to `implementation` in 
`grails-shell-cli/build.gradle` so it is included in the shadow JAR's runtime 
classpath.
   
   ## Reproduction
   
   1. Create a Grails 7 project with any custom script in `src/main/scripts/`
   2. Run `./grailsw dbm-gorm-diff` (or any grailsw command)
   3. Observe: `Failed to compile <script>.groovy: Unable to configure 
org.grails.web.mime.HttpServletRequestExtension due to missing dependency 
jakarta/servlet/ServletRequest`


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to