Deploy WAR or “fat” JAR?

后端 未结 3 1124
予麋鹿
予麋鹿 2021-02-02 11:23

I\'m noticing a lot of projects (DropWizard, Grails, etc.) starting to embrace the notion of a \"fat\" JAR (using an embedded web server like Jetty or Tomcat) vs. the traditiona

3条回答
  •  栀梦
    栀梦 (楼主)
    2021-02-02 12:01

    Distributing an application with an embedded webserver allows for standalone setup and running it by just calling java -jar application.jar.

    However, there may be users who want to be in control of which web server is used or who want to deploy multiple applications into a single webserver (e.g. in order to prevent port clashes especially with ports 80 and 8080). In that case a "fat" jar might cause problems or at least some unneeded code and thus a larger memory footprint.

    IMHO the best approach for those two cases would be to provide two artifacts: a "fat" jar for (easier) standalone setup and an application-only war/ear for those who want to deploy the application in their own container.

提交回复
热议问题