nowucca.com - personal software technology blog

If you find yourself wishing you could support multiple maven repositories on a single development box:

the good news is you can easily start using different maven repositories on a single box by using the "-s" or "--settings" option.

For example:
alias my-mvn="mvn -s ~/.m2/my-settings.xml"

Then in the my-settings.xml I specify the localRepository:

1
2
3
4
5
6
7
8
9
<br />
&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;</p>
<p>&lt;settings xmlns=&quot;http://maven.apache.org/SETTINGS/1.0.0&quot;<br />
          xmlns:xsi=&quot;http://www.w3.org/2001/XMLSchema-instance&quot;<br />
          xsi:schemaLocation=&quot;http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd&quot;&gt;<br />
  &lt;localRepository&gt;/path/to/homedir/.m2/my-repository&lt;/localRepository&gt;<br />
  &lt;interactiveMode&gt;true&lt;/interactiveMode&gt;<br />
  &lt;offline&gt;false&lt;/offline&gt;</p>
<p>&lt;/settings&gt;<br />

Et voila! Seamless builds for my-mvn ending up in a separate repository.