如何在WAR文件中包含依赖关系? [英] How to include dependencies in WAR file?
问题描述
我在Eclipse中有一个动态Web项目
,它与我的工作区中的另一个Java项目有依赖关系。在内置Tomcat服务器中运行Web项目时,我已将项目依赖关系添加到运行配置中的类路径。我想创建一个在外部服务器上部署Web项目的WAR。依赖Java项目被添加到Eclipse的 Java生成路径中,但是当我导出一个WAR文件时,不包括该库。也在订单和导出中选择了Java项目。如何创建一个包含我的依赖关系的WAR?
I have a Dynamic Web Project
in Eclipse which has a dependency to another Java project in my workspace. When running the web project in the build-in Tomcat server, I've added the project dependency to the class path in the run configuration. I would like to create a WAR for deploying the web project on an external server. The dependency Java project is added to the Java Build path in Eclipse, but when I export an WAR-file the library is not included. The Java project is also selected in the Order and Export. How can I create a WAR with where my dependencies are included?
推荐答案
Maven多模块项目非常适合在这里,
如果你不要去找它,只是将依赖关系(.jar)添加到Web项目(/ WEB-INF / lib)的运行时依赖关系中,并建立WAR
If you don't want to go for it then just the build the dependency into (.jar) add it to runtime dependency of web project(/WEB-INF/lib) and build up the WAR
这篇关于如何在WAR文件中包含依赖关系?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!