没有EJB的Web应用程序的WAR vs EAR? [英] WAR vs EAR for web application with no EJB?
问题描述
我有一个不使用EJB的Java EE Web应用程序.我有时会以Jetty/Tomcat为部署目标,因此需要WAR包装.但是,有时我也会同时针对JBoss和Websphere.
I have a Java EE web application that does not make use of EJBs. I am targeting Jetty/Tomcat for deployment some of the time and thus need a WAR packaging. However, I am also target JBoss and Websphere some of the time.
我的理解是,成熟的Java EE应用程序服务器可以采用EAR或WAR格式.我什么时候可以使用另一个,为什么?我了解它们都是标准的压缩文件格式,并且我阅读了10个不同的片段,试图对它们进行解释(包括以下内容一个),但进一步了解它们的优缺点.
My understanding is that full-blown Java EE application servers can take either EAR or WAR formats. When would I use one over the other and why? I understand they are both standard compressed file formats and I have read 10 different snippets that try to explain them (including this one), but am no closer to understanding the pros and cons of each.
推荐答案
如果只有Web模块,请使用WAR文件.如果您有其他Java EE模块-请使用EAR.尽管您只能在EAR中交付Web模块-这样做是没有意义的(并且您将需要进行更复杂的部署配置)
If you have only web modules - use WAR file. If you have different Java EE modules - use EAR. Though you can deliver only web modules in EAR - there is no point in doing this (and you will need to do more complex deployment configuration)
这篇关于没有EJB的Web应用程序的WAR vs EAR?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!