------
Guide to using Multiple Repositories
------
Jason van Zyl
------
2005-10-12
------
~~ Licensed to the Apache Software Foundation (ASF) under one
~~ or more contributor license agreements. See the NOTICE file
~~ distributed with this work for additional information
~~ regarding copyright ownership. The ASF licenses this file
~~ to you under the Apache License, Version 2.0 (the
~~ "License"); you may not use this file except in compliance
~~ with the License. You may obtain a copy of the License at
~~
~~ http://www.apache.org/licenses/LICENSE-2.0
~~
~~ Unless required by applicable law or agreed to in writing,
~~ software distributed under the License is distributed on an
~~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
~~ KIND, either express or implied. See the License for the
~~ specific language governing permissions and limitations
~~ under the License.
~~ NOTE: For help with the syntax of this file, see:
~~ http://maven.apache.org/doxia/references/apt-format.html
Setting up Multiple Repositories
There are two different ways that you can specify the use of multiple repositories. The first
way is to specify in a POM which repositories you want to use:
+----+
...
my-repo1
your custom repo
http://jarsm2.dyndns.dk
my-repo2
your custom repo
http://jarsm2.dyndns.dk
...
+----+
The <<>> element is inherited so you would usually specify the repositories
to use for a group of projects by defining a <<>> element at the top of your
inheritance chain.
<> You will also get the standard set of repositories as defined in the
{{{../introduction/introduction-to-the-pom.html#Super_POM}Super POM}}.
The other way you can specify the use of multiple repositories by creating a profile in
your <<<~/.m2/settings.xml>>> file like the following:
+----+
...
...
myprofile
my-repo2
your custom repo
http://jarsm2.dyndns.dk
...
myprofile
...
+----+
If you specify repositories in profiles you must remember to activate that
particular profile! As you can see above we do this by registering a profile
to be active in the <<>> element.
You could also activate this profile on the command like by executing the following
command:
+----+
mvn -Pmyprofile ...
+----+
In fact the <<<-P>>> option will take a CSV list of profiles to activate if you wish to
activate multiple profiles simultaneously.
<>: The settings descriptor documentation can be found on the {{{../../maven-settings/settings.html}Maven Local Settings Model Website}}.