如何让Eclipse Java EE自动生成一个Web项目的爆炸WAR? [英] How to have Eclipse Java EE automatically generate the exploded WAR for a web project?

查看:166
本文介绍了如何让Eclipse Java EE自动生成一个Web项目的爆炸WAR?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一个Java EE项目自动生成一个WAR文件,最好是分解 - 而不是选择Export - > War file。



各种服务器定义,但是无法使Java EE预览或HTTP服务器正常工作,并且在安装每个外部容器特定的服务器之前,如果有人做了这个工作,我想听到。



所以问题是:由Eclipse自动创建和维护WAR部署需要采取哪些步骤?






编辑:这是Eclipse 3.5 Java EE,它是Eclipse中的一个动态Web项目。我想要将WAR文件/树轻松地复制到网络驱动器,以便目标主机可访问。它运行一个嵌入式Jetty,但我对泛型WAR感兴趣。



MyEclipse可以做到这一点,但是我们正在使用普通的Eclipse。





$ b $编辑:这个特定的Web应用程序将在嵌入式Jetty中运行。由于这个问题被问到,我们已经从经验中发现,我们需要使用嵌入式Jetty,war文件(分解)和Hudson服务器构建的包含该应用程序的完整树,以避免构建部署过程中的人为步骤。因此,我们的答案是使用ant(使用ant4eclipse)编写脚本。






编辑2012:ant4eclipse方法被证明是一般的长期来说太僵硬,脆弱,所以我们已经转向了Maven。这解决了很多问题,包括这个。

解决方案

做一个蚂蚁任务来构建战争(如果你喜欢复制) 。然后在项目(项目 - >属性 - >构建器)中添加一个Ant构建器。只要您的项目被配置为自动构建,战争将始终是最新的。



这同样适用于maven或几乎任何其他构建工具。 p>

I need to have a Java EE project generate a WAR file automatically - preferably exploded - as opposed to choosing Export -> War file.

I have played with the various server definitions but have not been able to get either the Java EE preview or the HTTP server to work, and before installing each of the external container specific servers I'd like to hear if anybody has made this work.

So, question is: Which steps to take to have a WAR deployment automatically created and maintained by Eclipse?


EDIT: This is Eclipse 3.5 Java EE, and it is a Dynamic Web project in Eclipse. I want the WAR file/tree to be easily copyable to a network drive to be accessible for the target host. It runs an embedded Jetty, but I am interested in the generic WAR.

MyEclipse can do this, but we are standardizing on plain Eclipse.


EDIT: This particular web application will run inside an embedded Jetty. Since this question was asked we have found empirically that we need to have the complete tree containing the application with embedded Jetty, war file (exploded) and all built by the Hudson server in order to avoid human steps in the build-deploy-process. The answer for us therefore is scripting with ant (using ant4eclipse).


EDIT 2012: The ant4eclipse approach proved to be generally too inflexible and fragile in the long run, so we have switched to Maven. This solved very many problems, this one included.

解决方案

Make an ant task to build the war (and copy if you like). Then add an Ant builder to the project (project -> properties -> builders). As long as your project is configured to build automatically the war will always be upto date.

This would equally work with maven, or pretty much any other build tool.

这篇关于如何让Eclipse Java EE自动生成一个Web项目的爆炸WAR?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆