I have several projects which point to different internal repositories. Users on one project might not be able to see the repository on the other project, so I need a project specific settings.xml
for each project.
Create project-specific Maven settings indicates that I can do this by creating a MVN_ROOT/.mvn/maven.config
with
--settings ./.mvn/settings.xml
and then putting the repository information inside MVN_ROOT/.mvn/settings.xml
.
That seems to work and I can add those files to git and other users can use the repository automatically.
However, the repositories require validation, which requires that settings.xml
contain something like
...
<server>
<id>repo-proj-1</id>
<username>me</username>
<password>secret</password>
</server>
<server>
<id>repo-proj-2</id>
<username>my.name</username>
<password>secure</password>
</server>
...
Obviously, I do not want to put this information into the git repository. ~/.m2/settings.xml
is the obvious place to put that information. However, it appears that I can only have one user settings file, as my login information is not picked up when I try to build.
Is there a way to use both settings files?
This needs to work on Mac, Linux and Windows, so something like <xs:include>~/.m2/settings.xml</xs:include>
(XML include, probably not the right syntax) won't work as ~/.m2
is not usually the right location on Windows.
We are using Maven 3, and if a specific recent version is required, we can require users to upgrade to that version.