java Netbeans 添加新的 Maven 远程存储库
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/11947733/
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
Netbeans add new Maven remote repository
提问by Arthur
How to add new remote repo to the NetBeans 7.2 for using with the Dependency window (with repo indexing)?
如何将新的远程存储库添加到 NetBeans 7.2 以与依赖窗口一起使用(使用存储库索引)?
I found http://wiki.magnolia-cms.com/display/WIKI/setting+up+Netbeans+with+the+Magnolia+maven+repositorybut in 7.2 NB this window moved.
我找到了http://wiki.magnolia-cms.com/display/WIKI/setting+up+Netbeans+with+the+Magnolia+maven+repository但在 7.2 NB 这个窗口移动了。
In the Dependency there are no button for adding new remote Maven repos. I need to add http://repo1.maven.org/maven2/org/mortbay/jetty/jetty/7.0.0.pre5/to the NetBeans.
在依赖项中没有用于添加新的远程 Maven 存储库的按钮。我需要将http://repo1.maven.org/maven2/org/mortbay/jetty/jetty/7.0.0.pre5/添加到 NetBeans。
Sorry my bad English.
对不起,我的英语不好。
Thanks, Arthur.
谢谢,亚瑟。
采纳答案by gkuzmin
You can edit settings.xml
file in maven and add your repository to it. You should add something like:
您可以settings.xml
在 maven 中编辑文件并将您的存储库添加到其中。您应该添加如下内容:
<repositories>
<repository>
<id>nexus</id>
<name>Repository for JDK 1.6 builds</name>
<url>http://myrepo1:1111/contextpath/</url>
<layout>default</layout>
</repository>
<repository>
<id>nexus-major</id>
<name>Repository for JDK 1.6 builds 2</name>
<url>http://myrepo1:1111/contextpath2/</url>
<layout>default</layout>
</repository>
</repositories>
But this code should be wrapped in profile
tag, I think. For more details you can see this.
You can find settings file in $HOME/.m2
directory in linux and same directory in Windows.
但是profile
我认为这段代码应该被包裹在标签中。有关更多详细信息,您可以查看此内容。您可以$HOME/.m2
在 linux 目录和 Windows 相同目录中找到设置文件。
回答by Saket Mittal
here is easy method-
这是简单的方法-
Go to Services>Maven Repositories. Right Click>Add Repository