I have a set of related projects that use a self-hosted Nexus installation as a repository to download dependencies from. So I setup in my ~/.m2/settings.xml
file the following:
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.1.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.1.0 http://maven.apache.org/xsd/settings-1.1.0.xsd">
<mirrors>
<mirror>
<id>central</id>
<name>central</name>
<url>http://myserver/repository/maven-public/</url>
<mirrorOf>*</mirrorOf>
</mirror>
</mirrors>
</settings>
Everything works fine, except that when I want to work on the same machine on a project that is unrelated to that set of projects, Maven will try to use that Nexus repository to download the dependencies, and that is not desirable at this point.
I think the way to go is to set something in the pom.xml of the projects where I want to use my Nexus repository, but I can't figure it out.
I was reading about Maven profiles, but doesn't seem to be the right choice. <profiles>
should be a tag on the same level that <mirrors>
from this example, but how could I say that that mirror should only apply to some profile (that I was expecting to set in the pom.xml of my projects who want to use that repo).