Eclipse WTP、maven 和 m2eclipse - 不复制提供的 jar
使用 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
您必须安装
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-clickproject ---> 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
您需要将 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"
“provided”范围的依赖项不应该由 Maven 在最终的程序集中进行打包。
但是,请检查是否有其他“编译”依赖项也将这些相同的依赖项声明为“编译”。换句话说,
el-api
和jsp-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
andjsp-api
are being pulled in as transitive dependencies.Easiest way to check is using the Dependency Hierarchy view of m2eclipse.