更改NetBeans使用的Maven存储库 [英] Change Maven repository that NetBeans uses

查看:308
本文介绍了更改NetBeans使用的Maven存储库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Ubuntu,并且我已经在usr/share/maven中安装了Maven,并且我安装的项目进入/root/.m2/repository的存储库中.然后,我在NetBeans/java/maven中安装了具有自己的Maven的NetBeans,它引用的是它在/home/user/.m2/rep中创建的存储库. 如何使我的NetBeans使用"/root/.m2/存储库"而不是另一个. 我尝试研究服务,并希望更改存储库的路径,但这并不能阻止我.

I'm using Ubuntu and I already had an installation of Maven in usr/share/maven and the projects that I install go into repository which is at /root/.m2/repository. Then I installed NetBeans which has it's own Maven in NetBeans/java/maven and it is referring to a repository that it created in /home/user/.m2/rep. How do I make my NetBeans use "/root/.m2/repository" instead of the other one. I tried looking into services and looked to change the path to repository, but it's not letting me.

推荐答案

有2个文件会影响本地存储库的位置.

there are 2 files influencing the local repository location.

  • 〜/.m2/settings.xml-这个是针对每个用户的,因此计算机上的所有maven安装都将使用它.

  • ~/.m2/settings.xml - this one is per user, thus all maven installations on the computer will use it.

$ {maven.home}/conf/settings.xml-这对于给定的maven安装是私有的

${maven.home}/conf/settings.xml - this one is private to given maven installation

默认情况下,Netbeans使用在其自己的安装目录中定义的maven安装(随其提供),但是您可以在Tools/Options/Maven中进行更改,并使用自定义的maven安装,它将开始使用$ {maven.home }/conf/settings.xml.但是请注意,由各种linux发行版定制的安装有时可能会改组文件所在的位置.我总是建议使用直接从apache网站下载的maven二进制文件.

Netbeans uses by default the maven installation defined in it's own installation directory (it ships with it) but you can change that in Tools/Options/Maven and with your custom maven installation, it will start using your ${maven.home}/conf/settings.xml. However please note that the installations customized by various linux distributions can sometimes reshuffle where files are located. I would always recommend to use maven binaries downloaded straight from apache website.

这篇关于更改NetBeans使用的Maven存储库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆