简体   繁体   English

Eclipse WTP不会在WebContent中发布项目依赖项

[英]Eclipse WTP does not publish project dependencies in WebContent

I am currently working on a Java EE project. 我目前正在研究Java EE项目。 I have successfully developed a web service and deployed it under the build-in Apache server of Eclipse, for test purpose. 我已成功开发了一个Web服务,并将其部署在Eclipse的内置Apache服务器下,以进行测试。

I have now split my project into 2 projects : A master one and a dependency one (let's say "Utils"). 我现在将我的项目分成两个项目:一个主项目和一个依赖项目(比如说“Utils”)。 When developing, eclipse doesn't complain about compilation problems, since I have added the "Utils" project as a dependency in my "build path" setup. 在开发时,eclipse不会抱怨编译问题,因为我在“构建路径”设置中添加了“Utils”项目作为依赖项。

However, when launching Tomcat (as a embedded server), it complains about not finding the classes of "Utils" project. 但是,在启动Tomcat(作为嵌入式服务器)时,它抱怨没有找到“Utils”项目的类。

I was expecting eclipse to copy the "Utils/bin" into WebContent/WEb-INF/classes, but it does not. 我期待eclipse将“Utils / bin”复制到WebContent / WEb-INF / classes中,但事实并非如此。 How do I automate that ? 我该如何自动化? So that "Utils/bin" gets deployed into the WebFolder whenever a change occurs ? 每当发生变化时,“Utils / bin”会被部署到WebFolder中吗?

FYI, I do not use Maven yet (but I plan to). 仅供参考,我还没有使用Maven(但我打算)。

Thanks in advance for your help, Kind regards, 在此先感谢您的帮助,亲切的问候,

Raphael 拉斐尔

Ross' answer put me on the right track, but in Eclipse Helios I couldn't find the Java EE Module in my dynamic web project. Ross的回答让我走上正轨,但在Eclipse Helios中,我在动态Web项目中找不到Java EE模块。

Instead I found the way to add dependencies so they are built into the correct location was under the project's Properties -> Deployment Assembly, and from there I could add archives via path variable, from the file system, or from the workspace, as well as from a folder, a build path entry, or another project. 相反,我找到了添加依赖项的方法,因此它们被构建到项目的属性 - >部署程序集中的正确位置,从那里我可以通过路径变量,文件系统或工作区添加存档,以及从文件夹,构建路径条目或其他项目。

You can do this by adding the Utils project as a module to your 'Master' project. 您可以通过将Utils项目作为模块添加到“Master”项目来完成此操作。 I assume the master project is a web or ear application. 我假设主项目是web或ear应用程序。 Right click on the project -> properties -> Java EE module Dependencies. 右键单击项目 - > properties - > Java EE模块依赖项。 Add the Utils project to it. 将Utils项目添加到它。 Eclipse will include the Utils project in the deployment. Eclipse将在部署中包含Utils项目。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM