Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Change Maven repository that NetBeans uses

Tags:

maven

netbeans

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.

like image 658
user3491917 Avatar asked Jan 11 '23 21:01

user3491917


1 Answers

there are 2 files influencing the local repository location.

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

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

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.

like image 72
mkleint Avatar answered Jan 31 '23 14:01

mkleint