Java 爆炸式 WAR 文件的优点/缺点
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3906881/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Advantages/Disadvantages to exploded WAR files
提问by Kevin D
An answer to a question I read today suggested deploying an application as an exploded (unzipped) WAR. It got me thinking.
我今天读到的一个问题的答案建议将应用程序部署为分解(解压缩)的WAR。它让我思考。
Every deployment I've ever done to a JBoss/Tomcat has been with a a WAR/EARfile. At least as far as I can remember.
我对 JBoss/Tomcat 所做的每一次部署都带有一个 WAR/ EAR文件。至少据我所知。
Have I been making a mistake all these years?
这些年我一直在犯错吗?
Are there advantages to deploying an app in its expanded form rather than packaged up?
以扩展形式而不是打包形式部署应用程序是否有优势?
采纳答案by Martijn Verburg
I think that was my answer mentioning the exploded WAR in the other question. Exploded WARs are easier to navigate and you can deploy 'parts' of your application that much quicker (depending on how our Web/App server deals with this), e.g. Replace a single resource like a JSP page. However it can have some drawbacks:
我认为这是我在另一个问题中提到爆炸性War的答案。分解的 WAR 更易于导航,您可以更快地部署应用程序的“部分”(取决于我们的 Web/App 服务器如何处理),例如替换单个资源,如 JSP 页面。但是它可能有一些缺点:
Versioning- What version are you really running? "Hmmm, I'm not really sure now"
Security- Do you have the right permissioning in place for the exploded format?
Messiness- Files galore spread out all over your nice app/web server (some people really hate this).
版本控制- 您真正运行的是哪个版本?“嗯,我现在不太确定”
安全性- 您是否为展开的格式设置了正确的权限?
Messiness- 大量文件散布在您漂亮的应用程序/网络服务器上(有些人真的很讨厌这个)。
Bottom line:I tend to go exploded for prototype Dev work and then move to proper packaging the closer to PRD I get.
底线:我倾向于为原型开发工作而爆炸,然后在离 PRD 越近的地方进行适当的包装。
回答by Petar Minchev
AFAIK, hot deployment is possible only with exploded wars. And also during development it is easier to browse the project tree on the server. Of course there can be other advantages and disadvantages, which I will be glad to hear.
AFAIK,只有爆发War才能进行热部署。而且在开发过程中,浏览服务器上的项目树也更容易。当然,可能还有其他优点和缺点,我会很高兴听到的。
回答by Tomas Narros
At the development stage is more confortable to deploy it exploded. This way you can hot update some deployed resources (as can be the JSP pages).
在开发阶段部署起来比较舒服就炸了。通过这种方式,您可以热更新一些已部署的资源(如 JSP 页面)。
For Testing and Production environments, I prefer instead the packaged deployment: ligther, and easier to handle for the deployers.
对于测试和生产环境,我更喜欢打包部署:更轻巧,并且更易于部署人员处理。
回答by Yuval Adam
The only real benefit you receive from deploying an exploded ear/war is the ability to hot-swap files on the server, as well as the time saved on the packaging (which IMHO is negligible).
您从部署爆炸耳/War中获得的唯一真正好处是能够在服务器上热交换文件,以及节省包装时间(恕我直言可以忽略不计)。
Basically - this is a useful feature for development phases. I wouldn't choose this deployment method for a production environment.
基本上 - 这是开发阶段的有用功能。我不会为生产环境选择这种部署方法。
There are also some web application servers which require exploded wars for some esoteric features, but this is nothing I've encountered in regular usage.
还有一些 Web 应用程序服务器需要为一些深奥的功能爆发War,但我在常规使用中没有遇到过这种情况。
回答by mezzie
Not exploding a WAR/EAR when deploying does not make any difference to the Application Server. This is because underneath, they are all exploded.
部署时不爆炸 WAR/EAR 对 Application Server 没有任何影响。因为在下面,它们全都爆炸了。
For example, if you put a WAR file under webapp of tomcat, you will see that under your work directory, your WAR file will be exploded there.
比如你在tomcat的webapp下放一个WAR文件,你会看到在你的工作目录下,你的WAR文件会在那里爆炸。
Basically, WAR/EAR are just archiving your files so that it will be easier to move around and deploy
基本上,WAR/EAR 只是归档您的文件,以便更容易移动和部署
回答by Luca Molteni
Con: if you are on windows, you will often find that the OS randomly locks some file in the exploded .war, and it will be hard for you to delete the entire war and redeploy.
缺点:如果你在windows上,你会经常发现操作系统在爆炸后的.war中随机锁定了一些文件,你很难删除整个war并重新部署。