如何在Eclipse中自动搜索Maven依赖?

huangapple go评论107阅读模式
英文:

How to search for a maven dependency automatically in eclipse?

问题

我来自.NET世界,在Visual Studio中,对于NuGet的依赖搜索是自动进行的。您可以在NuGet包管理器中键入部分名称,它会为您搜索所有相关的包,然后您双击它,就完成了。我现在在一个Java项目上,不得不在互联网上搜索后,手动在pom.xml中键入Maven依赖。Eclipse是否有类似于Visual Studio的依赖搜索方式呢?

英文:

I come from .NET world and in Visual Studio the search for dependencies from nuget is automatic. You can type part of the name in the Nuget Packet Manager and it will search for you all related packages, then you double click on it and you are done. I'm on a Java project now and I'm having to manually type the Maven dependency on the pom.xml after searching for it on the internet. Does eclipse have a similar way to search for dependencies as in Visual Studio?

答案1

得分: 3

是的。如果您已经正确安装了M2E插件,您会发现在编辑pom.xml时,视图底部有几个选项卡,默认情况下选择了“pom.xml”。

点击“Dependencies”选项卡,然后点击“Add...”按钮。

在获取焦点的字段中,标有“Enter groupId,...”,输入您要查找的内容子字符串,无论是groupId还是artifactId(标签中有关于格式的更多提示)。如果您在输入字符串后等待片刻,您连接到的任何Maven仓库都会回应可能的匹配项,然后您可以选择并确认将其添加到pom.xml中。

英文:

Yes. If you have the M2E plugin properly installed, you will see that when you're editing the pom.xml, there are several tabs at the bottom of view, with "pom.xml" selected by default.

Click on the "Dependencies" tab, then the "Add.." button.

In the field that gets the focus, labeled "Enter groupId, ...", enter a substring of what you're looking for, be it a groupId or artifactId (the label has more hints about the format). If you wait a few moments after entering the string, whatever maven repositories you connect to would have responded with potential matches, which you can then select and confirm to add to the pom.xml.

huangapple
  • 本文由 发表于 2020年10月17日 02:20:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/64394441.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定