Eclipse中部署程序集与J2EE模块依赖关系的区别 [英] Difference between Deployment Assembly and J2EE Module Dependencies in Eclipse

查看:183
本文介绍了Eclipse中部署程序集与J2EE模块依赖关系的区别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当使用Eclipse 3.7 Indigo for Java EE开发人员时,会出现一些名为部署程序集的内容。我可以在google上找到它,并且理解它类似于 J2EE模块依赖项,在这里我们可以选择jar,哪些在EAR文件夹或WEB-INF / lib中位于WAR的情况下。现在有我的疑问,

When using a Eclipse 3.7 Indigo for Java EE Developers, there is something called Deployment Assembly . I could find on google and understood that it is similar to the J2EE Module dependencies where in we could select the jar and which goes and sits in the EAR folder or in WEB-INF/lib in case of WAR. Now the doubt I have is,

我有一个JavaProject 依赖关系。我已经通过 classpath 变量添加了所有依赖的Jars。现在,依赖关系项目添加为我的Web Project TestWebProject 的依赖项。 Web项目的编译是正确的,但是在运行时我收到一个错误,因为没有找到jar。我可以将这个我的include jar修复到依赖关系项目的部署程序集,这是一个独立的项目。

I have a JavaProject Dependencies. I have added all the dependent Jars via classpath variable. Now the Dependencies Project is added as dependency to my Web Project TestWebProject. The compilation of the Web Project is correct but during runtime I get an error because some jar was not found. I could fix this my include jar in Deployment Assembly of Dependencies Project, which is a standalone project.

问题是,为什么我必须在部署程序集中修复jar,因为首先,它是一个独立的项目,其次是如果我没有这个部署程序集,如何修复?

The question is that, why I had to fix the jar in deployment assembly since ,first, its a standalone project and second is if I would not have this deployment assembly , how could this be fixed?

推荐答案


我可以在google上找到,类似于J2EE模块依赖关系

直到Eclipse 3.5被称为J2EE模块依赖关系。在该版本之后,它被重命名为部署程序集。但是,在Java EE Web项目中,实际上是一样的。

It was called "J2EE Module Dependencies" until with Eclipse 3.5. After that version, it was renamed to "Deployment Assembly". But it's effectively the same in case of Java EE web projects.


问题是,为什么我必须在部署程序集中修复jar,因为它是一个独立的项目

因为这样Eclipse将自动构建项目的JAR文件,并放入Web项目部署的 / WEB-INF / lib 。如果不这样做,则在webapp的运行时间内JAR不可用,但只有在compiletime期间,并且Eclipse期望您已经构建并将其放置在运行时类路径中的其他位置,例如服务器自己的 / lib

Because this way Eclipse will autobuild a JAR file of the project and put in /WEB-INF/lib of the web project's deployment. If you don't do that, the JAR isn't available during webapp's runtime, but only during compiletime and Eclipse expects that you've already built and placed it anywhere else in runtime classpath, e.g. server's own /lib.


如果我没有这个部署程序集,怎么可以修复?

手动构建/导出JAR并放在webapp自己的 / WEB-INF / lib 或服务器自己的 / lib 中。然而,部署程序集配置更为简单和推荐。

Manually build/export the JAR and drop in webapp's own /WEB-INF/lib or server's own /lib. The "Deployment Assembly" configuration is however more easy and the recommended way.

  • Business Logic Layerin Servlet and JSP

这篇关于Eclipse中部署程序集与J2EE模块依赖关系的区别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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