首页 > 解决方案 > 放置 WAR 依赖项的“正确”位置在哪里?

问题描述

我正在为现有项目创建构建脚本。他们所有的 EAR 文件都是(手动)构建的,他们这样做的方式是将 WAR 的 JAR 依赖项放入 EARlib文件夹中。WAR 文件的WEB-INF/lib文件夹是空的。当我使用 gradle 构建时,它将 WAR 的 JAR 依赖项放入WEB-INF/lib文件夹中,而 EARlib文件夹中没有任何内容。

似乎两者都可以工作,而且(在我看来)更合乎逻辑的路径是将 WAR 依赖项放入WEB-INF/lib. 有首选或更正确的方法吗?

标签: javagradlejakarta-eewebsphere

解决方案


If you only have one WAR file in the EAR, then I would definitely recommend using WEB-INF/lib. Further, I would recommend deploying the WAR directly without the EAR file, as that removes a layer of unnecessary complexity.

The case where you would want to put dependency JARs in the EAR is when you have multiple WAR files that need the same dependencies. Then you can save space by sharing the same dependencies with all of the WARs in the app.

Hope this helps!


推荐阅读