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

Do NOT include compilation dependencies in production jar

Open codeconsole opened this issue 1 year ago • 2 comments

Amongst other things, javax.servlet is being bundled in the production jar/war. This is supposed to be provided by the container and adds an extra 30MB++ dependency to the final distribution. api is NOT a replacement for provided

Numerous dependencies should not be part of the final build:

    95505  10-10-2024 05:33   BOOT-INF/lib/javax.servlet-api-4.0.1.jar
   141302  10-09-2024 06:27   BOOT-INF/lib/ant-junit-1.10.14.jar
   384581  10-09-2024 06:16   BOOT-INF/lib/junit-4.13.2.jar
    78743  10-11-2024 06:28   BOOT-INF/lib/javax.el-api-3.0.1-b06.jar
   237335  10-10-2024 05:33   BOOT-INF/lib/javax.el-3.0.1-b12.jar
   792399  10-10-2024 05:33   BOOT-INF/lib/spring-test-5.3.39.jar
    15071  10-10-2024 05:33   BOOT-INF/lib/jta-1.1.jar
    82803  10-10-2024 05:31   BOOT-INF/lib/groovy-ant-3.0.21.jar
  2303167  10-09-2024 06:27   BOOT-INF/lib/ant-1.10.14.jar
    18871  10-09-2024 06:27   BOOT-INF/lib/ant-launcher-1.10.14.jar

codeconsole avatar Oct 12 '24 20:10 codeconsole

https://github.com/grails/grails-core/blob/37a284dc980122fb394804ca139f8237c91a5e8a/grails-core/build.gradle#L73-L74

https://github.com/grails/grails-core/commit/37a284dc980122fb394804ca139f8237c91a5e8a

codeconsole avatar Oct 12 '24 20:10 codeconsole

Deferred until 7.0

codeconsole avatar Oct 16 '24 18:10 codeconsole

Amongst other things, javax.servlet is being bundled in the production jar/war.

Does it need to be bundled in order for an executable jar to function?

jeffscottbrown avatar Nov 08 '24 15:11 jeffscottbrown

Amongst other things, javax.servlet is being bundled in the production jar/war.

Does it need to be bundled in order for an executable jar to function?

@jeffscottbrown no, not at all. It is never needed. The embedded server will include it's own version of the servlet api resulting it being there 2x.

codeconsole avatar Nov 08 '24 15:11 codeconsole

The embedded server will include it's own version of the servlet api resulting it being there 2x.

Thank you!

jeffscottbrown avatar Nov 08 '24 15:11 jeffscottbrown

This appears to still be an issue with the latest 7.x code line in a war file:

Image

jdaugherty avatar Jul 09 '25 17:07 jdaugherty