Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I tell maven to use specific settings.xml on project bases?

Tags:

maven

So my project comes with settings.xml together with its pom.xml.

Is there any way in pom.xml to specify to use the settings.xml in the same folder?

like image 336
Koray Tugay Avatar asked Feb 13 '23 18:02

Koray Tugay


1 Answers

It seems that Maven does not allow what you are trying to do, and moreover specifically advised against it. The following excerpt is taken from the official documentation which is Apache Maven - Settings Reference:

The settings element in the settings.xml file contains elements used to define values which configure Maven execution in various ways, like the pom.xml, but should not be bundled to any specific project, or distributed to an audience. These include values such as the local repository location, alternate remote repository servers, and authentication information.

There are two locations where a settings.xml file may live:

The Maven install: $M2_HOME/conf/settings.xml
A user's install: ${user.home}/.m2/settings.xml

The former settings.xml are also called global settings, the latter settings.xml are referred to as user settings. If both files exists, their contents gets merged, with the user-specific settings.xml being dominant.

like image 165
geoand Avatar answered Feb 15 '23 11:02

geoand