如何从 Eclipse 中的动态 Web 项目构建 EAR 文件?
我正在考虑将我在 Eclipse 中编写的 Web 服务部署到 EAR 文件中。我能够将其导出为 WAR 并将其部署在 Tomcat 上,一切顺利,但最终产品不会在 Tomcat 上,也不会是 WAR 文件。我需要使用 Websphere 作为服务器,我可以访问该服务器并可以部署有效的 EAR 文件...如果我有要部署的 EAR 文件的话。
长话短说,如何从 Eclipse 中的动态 Web 项目导出 EAR 文件?
I'm looking at deploying a web service which I've written in Eclipse to an EAR file. I'm able to export it as a WAR and deploy it on Tomcat all fine and dandy, but the final product won't be on Tomcat, and won't be a WAR file. I'll need to use Websphere as a server, which I have access to and can deploy valid EAR files... if I had an EAR file to deploy.
So long story short, how do I export an EAR file from a Dynamic Web Project in Eclipse?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您需要在 Eclipse 中创建一个企业应用程序项目(基本上是一个 EAR),将动态 Web 项目添加到 EAR 项目中,然后导出整个项目。
You need to create an Enterprise Application Project (basically, an EAR) in Eclipse, add the Dynamic Web Project to the EAR project, and then export the whole thing.
为此,我使用 Ant 构建脚本(您可以在 Eclipse 中创建一个新的 Ant 文件,将其存储在动态 Web 项目根目录中,然后当您想从 Eclipse 运行它时右键单击 > 运行它。如下所示。基本上将您的 war 复制到目录中,${earDir} 在下面的脚本中,并将其构建为 EAR(EAR 只是 JAR 的一种类型):
您的 was.policy 文件将类似于这(不好授予所有权限但一旦启动并运行,您可以稍后更改它):
您的 application.xml 文件将是这样的:
那里的 ids 应该没问题,我相信它们需要对每个 EAR 是唯一的(或者是服务器无法记住)。
我希望这有帮助。
for this I use an Ant build script, (you can create a new Ant file in Eclipse, store it in your dynamic web project root and then right click > run on it when you want to run it from eclipse. Something like below. Basically copy your war to a directory, ${earDir} in the script below, and build that to an EAR (an EAR is just a type of JAR) :
Your was.policy file will be something like this (not good to give all permissions but you can change it later once you have it up and running):
Your application.xml file will be something like this:
The ids there should be ok they need to be unique per EAR I believe (or is it server cant remember).
I hope this helps.