在Eclipse部署程序集中将Web项目添加为jar [英] Adding a Web Project as a jar in an Eclipse Deployment Assembly
问题描述
现在我正在开发的网站由几个java项目和一个主要的web项目 A
组成。我使用的IDE是Eclipse Helios。
The site I'm working on now is made up of several java projects and a main web project A
which references them. The IDE I'm using is Eclipse Helios.
我要完成的是添加一个新项目 B
到堆栈。该项目也是主要项目,但本身就是一个Web项目。当我将 B
添加到 A
的部署程序集中时,在发布时,Eclipse将自动将其打包为战争并部署到服务器的 WEB-INF / lib
。
What I'm trying to accomplish is adding a new project B
to the stack. The project is also referenced by the main one, but is in itself a Web Project. When I add B
to the Deployment Assembly of A
, when publishing, Eclipse automatically packages it as a war and deploys it to the server's WEB-INF/lib
.
我希望将其部署为一个jar,还可以保持项目的Web性质,因为它具有运行在其上的一些功能(和测试)。我有一个蚂蚁任务,用于从 B
中构建一个jar,但是我不知道如何在Eclipse中使用它们。此外,我不知道是否可以使Eclipse从Web项目部署一个jar。
I want it to be deployed as a jar, but also keep the project's web nature, as it has some features (and tests) that are run on it. I have ant tasks in place for building a jar out of B
, but I don't know how to use them in Eclipse. Also, I'm not sure if it's possible to make Eclipse deploy a jar out of a web project.
我可以手动添加jar(作为工作空间中的归档) ),但这意味着每当有人清理所有项目时,$ code> B 的jar将被删除而不会生成,因为构建只会将类和部署包编译为战争。
I can add the jar manually (as an archive from the workspace), but that would mean that whenever someone cleans all projects, the jar for B
would get deleted and not generated, as the build only compiles the classes and the deploy packages them into the war.
PS我知道设计很差,但是改变它是没有问题的,因为我没有权限:)。
P.S. I know the design is poor, but changing it is out of the question as I don't have the authority :).
推荐答案
我在 Eclipse Luna
-
项目B项目方案:选择实用程序模块而不是静态Web模块或动态Web模块
Project B "Project Facets" : select "Utility Module" instead of "Static Web Module" or "Dynamic Web Module"
:删除B并再添加一次。
Project A "Deployment Assembly" : remove "B" and add it another time.
=> B的部署路径现在为B.jar
=> The "Deploy Path" of B is now B.jar
这篇关于在Eclipse部署程序集中将Web项目添加为jar的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!