无法使用 m2e 插件在 Eclipse Kepler 中搜索工件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/18047843/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Cannot search for artifact in Eclipse Kepler using m2e plugin
提问by Subby
I tried the new Eclipse Kepler that already comes with a maven plugin.
我尝试了新的 Eclipse Kepler,它已经带有一个 Maven 插件。
But when I want to add a dependency (open the pom.xml, go to dependencies tab and click add) I can input some string like "jetty" in the search box but nothing happens. In older versions I got a list of all dependencies containing "jetty".
但是当我想添加一个依赖项时(打开 pom.xml,转到依赖项选项卡并单击添加)我可以在搜索框中输入一些像“jetty”这样的字符串,但没有任何反应。在旧版本中,我得到了包含“jetty”的所有依赖项的列表。
I don't know if this is important but I directly get an info when opening the "add dependency screen": "Artifact Id cannot be empty".
我不知道这是否重要,但我在打开“添加依赖项屏幕”时直接得到一个信息:“工件 ID 不能为空”。
I do not use a proxy or have any network issues.
我不使用代理或有任何网络问题。
I also missed an information something like: "indexing maven repo..."
我还错过了一些信息,例如:“索引 maven repo...”
Any idea?
任何的想法?
Thanks!
谢谢!
回答by Yogesh
I had similar situation and by googling for a while i found out that this is most likely because your central Repository index might never have been updated. For this what you can do is
我遇到了类似的情况,通过谷歌搜索一段时间,我发现这很可能是因为您的中央存储库索引可能永远不会更新。为此,您可以做的是
- Go to Window > Show View > Other >type Maven in filter and select Maven Repositories.
- In Maven Repositoriestab Expand Global Repositories, Right-click on centraland Update Index.
- 转到Window > Show View > Other >在过滤器中输入 Maven 并选择Maven Repositories。
- 在Maven Repositories选项卡中展开Global Repositories,右键单击central和Update Index。
also you can set up index to update on eclipse startup Windows > Preferences > Mavenand check "Download repository index updates on startup".
您也可以设置索引以在 Eclipse 启动时更新Windows > Preferences > Maven并检查“在启动时下载存储库索引更新”。
Hope this helps some one else.
希望这对其他人有所帮助。
回答by Dennie
Windows> Preferences> Mavenand check "Download repository index updates on startup".
Windows>首选项> Maven并选中“在启动时下载存储库索引更新”。
Restart and you're all fixed.
重新启动,你就全部解决了。
回答by Subby
Very strange but now it worked using the following way:
很奇怪,但现在它使用以下方式工作:
- Add some dependency directly in the pom.xml
- Save the pom.xml to trigger the change. Now the library added directly appears in the project.
- Now I also got messages in the status bar like "indexing... " and "searching repository"
- I am now able to add an dependency using the method from the question. It now retrieves a list of artifacts of which I can choose.
- 直接在 pom.xml 中添加一些依赖
- 保存 pom.xml 以触发更改。现在添加的库直接出现在项目中。
- 现在我还在状态栏中收到消息,如“索引...”和“搜索存储库”
- 我现在可以使用问题中的方法添加依赖项。它现在检索我可以选择的工件列表。
Maybe a bug as also the add dialog should trigger the first repository search/indexing.
也许一个错误以及添加对话框应该触发第一个存储库搜索/索引。
The information: "Artifact Id cannot be empty" still appears and had nothing to do with the problem.
仍然出现“Artifact Id cannot be empty”信息,与问题无关。
回答by erasmus77
I solved the same problem by going to Window > Show View > Other > Maven > Maven Repositories
我通过转到 Window > Show View > Other > Maven > Maven Repositories 解决了同样的问题
Expand global repositories right click central > Rebuild index (wait for it) When it finishes Expand local repositories and do the same for the local repository (rebuild index) If you encounter some error simply try again. It worked for the second time and now i can search maven repo.
展开全局存储库右键单击中央 > 重建索引(等待它)完成后 展开本地存储库并对本地存储库执行相同操作(重建索引) 如果您遇到一些错误,只需再试一次。它第二次工作了,现在我可以搜索 maven repo。
回答by user2645075
Another gotcha is that it won't start searching until you've entered several characters
另一个问题是,在您输入多个字符之前,它不会开始搜索
- nz.ac
- com.mi
- junit
- 新西兰
- com.mi
- 朱尼特
回答by Renat Gatin
I had same problem! It is because you do not have STS (Spring Tool Suite) installed. Go to Marketplace install it and it is gonna work!
我有同样的问题!这是因为您没有安装 STS(Spring Tool Suite)。去市场安装它,它会工作!
回答by randombee
In case it can help someone... I had the same problem, tried to fix it doing all the steps everyone is mentioning in the other answers and I couldn't fix it like that. In the end, the solution was to delete the content of the settings.xmlfile in my .m2folder. For some reason, it was using a different global repository, not the default maven one. After that, I got the expected behaviour.
如果它可以帮助某人......我遇到了同样的问题,试图通过每个人在其他答案中提到的所有步骤来修复它,但我无法像那样修复它。最后,解决办法是删除我的.m2文件夹中settings.xml文件的内容。出于某种原因,它使用了不同的全局存储库,而不是默认的 maven 存储库。在那之后,我得到了预期的行为。
回答by Trant Batey
I recently had this same issue. I followed all of the suggestion above and the problem persisted. Then I opened the "Local Repository", right click on the "Local Repository" sub link>rebuild index. That fixed the issue. So, if "Rebuild Index" on the "Global Repository/central" doesn't work, try "Rebuild Index" on the "Local Repository/Local Repository"
我最近遇到了同样的问题。我遵循了上面的所有建议,但问题仍然存在。然后我打开“本地存储库”,右键单击“本地存储库”子链接>重建索引。这解决了问题。因此,如果“全局存储库/中央”上的“重建索引”不起作用,请尝试“本地存储库/本地存储库”上的“重建索引”
回答by user3577339
I did "In Maven Repositories tab Expand Global Repositories, Right-click on central and Update Index", it did not work, then click left expand triangle, it ran, and wait for while. Now it works
我做了“在 Maven 存储库选项卡中展开全局存储库,右键单击中央和更新索引”,它不起作用,然后单击左扩展三角形,它运行,并等待一段时间。现在它起作用了
回答by enri
I had the same problem. I have done what Yogi and erasmus77 said but after all the message "Artifact Id cannot be empty" remained. So I ignored the messageand I wrote the dependency in the search bar and then results appeared!
我有同样的问题。我已经做了 Yogi 和erasmus77 所说的,但毕竟“Artifact Id 不能为空”的消息仍然存在。所以我忽略了这个消息,我在搜索栏中写了依赖,然后结果出现了!
Thank you for this question!
谢谢你的这个问题!