Eclipse WTP、maven 和 m2eclipse - 不复制提供的 jar

发布于 2024-11-28 19:31:12 字数 171 浏览 1 评论 0原文

使用 Eclipse WTP 和 m2eclipse 时,可以将所有依赖项复制到 WEB-INF/lib(通过在部署程序集中添加“maven 依赖项”)。但是,范围为“provided”的依赖项也会被复制,例如 el-api 和 jsp-api。这会扰乱容器并且无法启动。

有什么解决方案不复制“提供的”罐子吗?

When using Eclipse WTP and m2eclipse it is possible to copy all dependencies to WEB-INF/lib (by adding "maven dependencies" in the Deployment assembly). However, dependencies with scope "provided" are also copied, for example el-api and jsp-api. That disturbs the container and it fails to start.

Any solution for not copying the "provided" jars?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

長街聽風 2024-12-05 19:31:12

您必须安装 m2eclipse-wtp 这是 m2eclipse 的额外插件。它会为您完成这项工作。安装 m2eclipse-wtp 后,只需右键单击 project --->;梅文 -->更新项目配置,您会发现所提供范围的库将不再受到WTP容器的不信任。

请参阅了解安装说明。我建议安装最新版本的 m2eclipse-wtp (针对 Eclipse 3.6 + 进行测试),因为它解决了以前版本中的一些主要错误。

编辑:感谢弗雷德的更正

You have to install the m2eclipse-wtp which is an extra plug-in for m2eclipse .It will do this job for you. After installing the m2eclipse-wtp , just right-click project ---> Maven --> Update Project Configuration , you will find that the libs of the provided scope will not be distrusted to the WTP container anymore.

See this for the installation instruction. I would suggest to install the latest version of m2eclipse-wtp (tested against Eclipse 3.6 +) as it solves some major bugs in the previous versions.

Edit: Thanks Fred for the correction

夜唯美灬不弃 2024-12-05 19:31:12

您需要将 Maven 库添加到 WTP 的部署程序集...

右键单击您的项目,选择“属性”

从属性菜单中单击“部署程序集”

单击“添加”-> “Java Build Path Entries”,然后单击“Next”

在列表中选择“Maven Libraries”,然后单击“Finish”

You need to add the Maven Library to WTP's Deployment Assembly...

Right click on your project, select "Properties"

From the properties menu click "Deployment Assembly"

Click "Add" -> "Java Build Path Entries" then click "Next"

Select "Maven Libraries" on the list and click "Finish"

在你怀里撒娇 2024-12-05 19:31:12

“provided”范围的依赖项不应该由 Maven 在最终的程序集中进行打包。

但是,请检查是否有其他“编译”依赖项也将这些相同的依赖项声明为“编译”。换句话说,el-apijsp-api 很可能被作为传递依赖项引入。

最简单的检查方法是使用 m2eclipse 的依赖层次结构视图。

Dependencies of scope "provided" shouldn't be packaged by Maven in the final assembly.

However, check if you have other dependencies that are "compile" that also declare those same dependencies as "compile". In other words, it's very likely that el-api and jsp-api are being pulled in as transitive dependencies.

Easiest way to check is using the Dependency Hierarchy view of m2eclipse.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文