Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
105 lines (84 sloc) 2.84 KB
------
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:
+----+
<project>
...
<repositories>
<repository>
<id>my-repo1</id>
<name>your custom repo</name>
<url>http://jarsm2.dyndns.dk</url>
</repository>
<repository>
<id>my-repo2</id>
<name>your custom repo</name>
<url>http://jarsm2.dyndns.dk</url>
</repository>
</repositories>
...
</project>
+----+
<<NOTE:>> 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 <<<$\{user.home\}/.m2/settings.xml>>> file like the following:
+----+
<settings>
...
<profiles>
...
<profile>
<id>myprofile</id>
<repositories>
<repository>
<id>my-repo2</id>
<name>your custom repo</name>
<url>http://jarsm2.dyndns.dk</url>
</repository>
</repositories>
</profile>
...
</profiles>
<activeProfiles>
<activeProfile>myprofile</activeProfile>
</activeProfiles>
...
</settings>
+----+
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 <<<activeProfiles>>> 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.
<<Note>>: The settings descriptor documentation can be found on the {{{../../maven-settings/settings.html}Maven Local Settings Model Website}}.
You can’t perform that action at this time.