有没有像“mvn search”这样的插件?
我想使用VIM进行Java编程,但是我发现在命令行中查找和设置Maven依赖非常麻烦。
有没有像“apt-cache search”这样的搜索依赖的插件?并向 pom.xml 添加依赖项,如“apt-get install”?
这应该是一个基本功能,为什么没有这样的插件呢?谢谢 :)
I want to use VIM for Java programing, but I found it is very cumbersome to find and set a Maven dependence at command line.
Is there a plugin to search dependence like "apt-cache search"? and adding a dependence to pom.xml like "apt-get install"?
This should be a basic function, Why there is no such plugin ? Thank you :)
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
没有插件,我无法回答为什么。
然而,在我使用的 IDE (IntelliJ) 和其他可能的 IDE 中,有一些帮助弹出窗口询问您是否要自动添加对 POM 的依赖项(很可能仅适用于本地存储库中的内容)。此外,在编辑 POM 时,本地存储库中已有的任何内容都会在您键入依赖项时自动完成(如果有多个版本,则会显示可供选择的版本列表)。只是让您知道切换到 IDE 会对您有所帮助。
我认为您可以做的最好的搜索就是使用加载了 MVNRepository 的浏览器。您可以搜索库,当您看到所需的库时,可以将示例依赖项复制粘贴到您的 POM 中。请注意,列出的一小部分依赖项不在最常见的公共存储库中,需要您自定义存储库列表。
There is no plugin, and I can't answer why.
However in the IDE I use (IntelliJ) and probably others, there are help pop-ups that ask you if you want to add a dependency to a POM automatically (most likely only for things in your local repository). Also, when editing a POM, anything already in your local repository will autocomplete as you type out the dependency (and if there are multiple versions, the list of versions to choose from is displayed). Just letting you know in case switching to an IDE would help you.
I think the best you can do for search is use a browser off to the side with MVNRepository loaded up. You can search for libraries and when you see the one you want, you can copy-paste the example dependency into your POM. Note a small fraction of dependencies listed there are not in the most common public repositories and require you to customize your repository list.
maven 依赖插件 可以帮助你列出/分析依赖关系。但它不能为你添加依赖。
事实上,如果您更喜欢 VI 编辑文件,为什么不在 vim 中打开 pom.xml,然后直接编辑该文件呢?
maven dependency plugin could help you a little bit on listing/analyzing dependencies. But it cannot add a dependency for you.
in fact, if you prefer VI to edit files, why not just open pom.xml in your vim, and edit the file directly?
如果您更喜欢使用 Vim,您仍然可以在 Eclipse 中进行操作:尝试免费的 Vrapper 。在非免费方面,您可以尝试 Viable 或 viPlugin。
然后,Eclipse 具有 Sonatype 的 m2e 插件,它允许您使用流畅的搜索向导添加依赖项和插件(不是还有一大堆其他帮助功能)。
If you prefer working with Vim, you can still do it in Eclipse: try Vrapper on the free side. On the non-free side, you can try Viable or viPlugin.
Eclipse then has Sonatype's m2e plugin, which lets you add dependencies and plugins with a sleek search wizard (not to say a whole bunch of other helping features).