grails-core icon indicating copy to clipboard operation
grails-core copied to clipboard

Servlet-api should only be used during compilation and is not needed during runtime as it is provided by container

Open codeconsole opened this issue 1 year ago • 3 comments

This commit is forcing jakarta.servlet:jakarta.servlet-api to be resolved as an api dependency in several locations

Numerous dependencies should not be part of the final build:

configurations {
    all {
        exclude group: "jakarta.servlet", module: "jakarta.servlet-api"
        exclude group: "org.glassfish.jaxb", module: "jaxb-runtime"
        exclude group: "org.junit.jupiter", module: "junit-jupiter-api"
        exclude group: "org.apache.ant", module: "ant"
        exclude group: "org.springframework", module: "spring-test"
        exclude group: "org.hibernate", module: "hibernate-core" // dependency of eh-cache, not hibernate-core-jakarta
        exclude group: "jakarta.el", module: "jakarta.el-api"
        exclude group: "org.fusesource.jansi", module: "jansi"  // developmentOnly
        exclude group: "org.apache.groovy", module: "groovy-ant" // developmentOnly
    }
}

This should NOT be solved with exclusions. Dependencies should not be included in fhe first place.

codeconsole avatar Oct 12 '24 20:10 codeconsole

Similar problem in 6.2.x https://github.com/grails/grails-core/issues/13745 that has existing since 5.0.0

codeconsole avatar Oct 12 '24 20:10 codeconsole

This commit is forcing jakarta.servlet:jakarta.servlet-api to be resolved as an api dependency in several locations

PR #13545 updated the dependency from javax.servlet to jakarta.servlet, but did not modify the dependency configuration. Adjusting the configuration was outside the scope of this PR.

matrei avatar Oct 12 '24 22:10 matrei

The most BASIC Grails 5.3.6 app requires 177 jar files and is 75M (grails create-app) The most BASIC Grails 6.2.1 app requires 174 jar files and is 133M (grails create-app) The most BASIC Spring Boot 3.3.4 app requires 31 jar files and is 19M (spring init --dependencies=web)

codeconsole avatar Oct 12 '24 23:10 codeconsole

https://github.com/apache/grails-core/pull/14970

jamesfredley avatar Aug 18 '25 23:08 jamesfredley