m2e 在本地存储库中未检测到任何 jar
在我的 Java 项目中,它具有 Maven“性质”,m2e 版本 1.0.10020110804 未检测到位于我的本地存储库中的任何 jar。我可以从命令行使用 maven 成功编译/安装,但是当我在 Eclipse 中打开项目时,我收到 100 多个(无法解析为类型)错误的通知。有谁知道如何解决这个问题?我尝试过更新依赖项并清理我的项目,但都不起作用。我的本地存储库在“用户设置”下的 m2e 中设置。
In my Java project, which has a maven 'nature', m2e version 1.0.10020110804 does NOT detect any jars located in my local repo. I can successfully compile/install using maven from the command line, but when I open the project in Eclipse I'm notified of 100+ (cannot be resolved to a type) errors. Does anyone know how to resolve this problem? I've tried updating dependencies and cleaning my project, but neither works. My local repo is set in m2e under 'User Settings'.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
M2e 需要配置为使用您的本地主存储库。一般来说,人们会期望它自动执行此操作...但在您的情况下,它使用不同的主存储库。
我在这里感受到您的痛苦 - 我已经看到它在某些情况下使用 eclipse 内部的默认存储库,如果您有/需要自己的本地 .m2 目录,这可能会导致问题。
我相信当我第一次遇到这个问题时,我正在安装 m2e 插件,而没有首先安装将 maven 设置为独立应用程序。在这种情况下,m2e 插件可能使用本地 maven copy/repo 。
所以这个故事的寓意是:您需要配置插件才能正确“查看”和“使用”您的 M2_HOME。
这里有一些关于进行设置的好提示:Eclipse m2eclipse 从本地存储库获取依赖项
通过编辑 m2e 插件设置在首选项窗口中,您可以确保 m2e 正在访问正确的 Maven HOME 目录,这将解决此问题。
M2e needs to be configured to use your local , home repository . In general, one would expect it to do so automatically... But in your case, its using a different home repository.
I feel your pain here - I have seen it use a default repo inside of eclipse in some cases, which can cause problems if you have / need your own local .m2 directory.
I believe that when I first got this problem, I was installing the m2e plugin without having installed first setting maven up as a standalone application. In this case, it might be that the m2e plugin uses a local maven copy/repo .
So the moral of the story is : You need to configure the plugin to "see" and "use" your M2_HOME correctly.
There are some good tips on getting the settings right here : Eclipse m2eclipse getting dependancies from local repository
By editing the m2e plugin settings through the Preferences window, you can ensure that m2e is accessing the right Maven HOME directory, and that will solve this problem.
我最近遇到了同样的问题。根本原因是我将我的项目作为通用项目导入,然后向其中添加了 maven 和 java 性质。我通过关闭并从工作区中删除该项目并重新导入为 Maven 项目,然后将其与本地存储库同步来解决了该问题。 HTH。
I recently faced the same problem. The root cause was that I imported my project as a generic project and later added maven and java natures to it. I resolved the issue by closing and removing the project from my workspace and re-importing as a maven project and then syncing it with my local repo. HTH.
您尝试刷新工作区吗?
我有类似的经历,并且我已经尝试了所有这些方法,因为它在我的单元测试中无法识别 Rhino jar。错误少了很多,但仍然有一些。不得不关闭项目,关闭eclipse,运行mvn clean编译,打开eclipse,打开项目。
did you try refreshing the workspace?
I am having a similar experience, and I've tried all those thing because it wasn't recognizing the Rhino jar in my unit tests. A lot less errors, but still a couple. Had to close the project, close eclipse, run mvn clean compile, open eclipse, open the project.