This is an automated email from the ASF dual-hosted git repository. jamesfredley pushed a commit to branch docs/cli-servlet-dependency-comment in repository https://gitbox.apache.org/repos/asf/grails-core.git
commit 4ff82d73e9cc827244c2a906a93f772b7ed9e9c4 Author: James Fredley <[email protected]> AuthorDate: Thu Feb 19 07:27:25 2026 -0500 docs: add comment explaining why jakarta.servlet-api is implementation scope Document the rationale for the compileOnly-to-implementation change from PR #15392. The servlet API must be on the shadow JAR runtime classpath because grails-web-common's HttpServletRequestExtension is auto-discovered during script compilation, and CLI commands that generate web-layer code also depend on it. Assisted-by: Claude Code <[email protected]> --- grails-shell-cli/build.gradle | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/grails-shell-cli/build.gradle b/grails-shell-cli/build.gradle index 28c4fc4e82..b53f35a2a5 100644 --- a/grails-shell-cli/build.gradle +++ b/grails-shell-cli/build.gradle @@ -61,6 +61,12 @@ dependencies { compileOnly 'org.springframework.boot:spring-boot-loader-tools' compileOnly 'org.springframework:spring-web' api 'org.springframework.boot:spring-boot-cli' + // Must be 'implementation' (not 'compileOnly') so the servlet API is included in the shadow JAR. + // grails-web-common registers HttpServletRequestExtension as a Groovy extension module, which is + // auto-discovered when GroovyScriptCommandFactory compiles custom scripts in src/main/scripts/. + // Without jakarta.servlet.ServletRequest on the runtime classpath, all grailsw commands fail with + // NoClassDefFoundError when custom scripts exist. The servlet API is also required by CLI commands + // such as create-controller, generate-all, and scaffolding that parse and generate web-layer code. implementation 'jakarta.servlet:jakarta.servlet-api' compileOnly "net.sf.jopt-simple:jopt-simple:$joptSimpleVersion"
