How to include dependencies in WAR file?

左心房为你撑大大i 提交于 2019-11-28 21:36:47

Maven multimodule project is well suited here,

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

Waliaula Makokha

I am using Eclipse Helios Java EE. Right click on the project. On the properties window for that project select "Deployment Assembly" in the tree on the left hand side. Click add and on the window that appears select "Java Build Path Entries". Select all the libraries that you wish to be included in the .war file. Proceed to export the project as a .war file. You will find the libraries under /WEB-INF/lib.

You need to install Maven for Eclipse and convert your project to a Maven-project (Right-click project -> Configure -> Convert to Maven project).

As you have configured your project, you can run it as "Maven Build..." and specify install:install to build a war file which, by default, includes your libraries from Maven.

Maven has quite to much feautures to explain all that right now. Just take a look at the project site. It'll take you some time to understand and configure but when you understand it, it will save a lot of time for you :)

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!