kayahr
kayahr

Reputation: 22050

Set Maven repository directory

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?

Upvotes: 4

Views: 5358

Answers (1)

Pascal Thivent
Pascal Thivent

Reputation: 570545

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).

Upvotes: 9

Related Questions