java - 放置 WAR 依赖项的“正确”位置在哪里?
问题描述
我正在为现有项目创建构建脚本。他们所有的 EAR 文件都是(手动)构建的,他们这样做的方式是将 WAR 的 JAR 依赖项放入 EARlib
文件夹中。WAR 文件的WEB-INF/lib
文件夹是空的。当我使用 gradle 构建时,它将 WAR 的 JAR 依赖项放入WEB-INF/lib
文件夹中,而 EARlib
文件夹中没有任何内容。
似乎两者都可以工作,而且(在我看来)更合乎逻辑的路径是将 WAR 依赖项放入WEB-INF/lib
. 有首选或更正确的方法吗?
解决方案
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!
推荐阅读
- javascript - 我们可以根据数组本身的键在数组中创建重复的对象吗?
- sql - 我们如何在 timescale db 中找到块的时间范围?
- c# - Xamarin.Android ViewModelProvider 没有工厂
- r - 为返回的 purrr::map2() 列表的内容提供不同的对象名称
- python - 如何在 django 表单中过滤查询集?
- android - 使用 Eclipse 在 Android 中的清单属性
- php - 如何使用 PHP 从数据库中获取下拉菜单的值
- jenkins - 在詹金斯管道的多个步骤中定义和访问变量
- chef-infra - In a chef loop over a hash, execute resource interpolates the last entry instead of current entry
- caching - Chrome 不缓存大型 GLTF 资产