Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set Maven repository directory

Tags:

maven-2

hudson

I'm using the Continuous Integration Software "Hudson" to build Maven 2 projects. The Hudson server is deployed in a Tomcat running with the privileges of the "www-data" User on a Debian machine. When Hudson runs Maven to build a project then it complains that it can't write to the repository "/var/www/.m2". /var/www is the Home-Directory of the www-data User. I don't want this directory in /var/www. How can I configure Hudson or Maven to use an other directory for the Maven repository?

like image 258
kayahr Avatar asked Jan 21 '23 03:01

kayahr


1 Answers

You can configure the path to the local repository by setting the <localRepository> element (which defaults to ~/.m2/repository) of the settings.xml:

<settings>
  ...
  <localRepository>/path/to/local/repo</localRepository>
  ...
</settings>

The default location for the settings file is ~/.m2/settings.xml (but you can specify an alternate path for the user settings file using -s,--settings <arg> when invoking maven).

like image 97
Pascal Thivent Avatar answered Jan 23 '23 16:01

Pascal Thivent