grails / grails-core

The Grails Web Application Framework
http://grails.org
Apache License 2.0
2.78k stars 950 forks source link

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

Open codeconsole opened 1 week ago

codeconsole commented 1 week ago

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 commented 1 week ago

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

matrei commented 1 week ago

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.

codeconsole commented 1 week ago

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)