blob: 400a29b58a7b4a2bcbc9ae979204a2d6466d6e86 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<title>Archiva Documentation - Using as a Repository</title>
<style type="text/css" media="all">
@import url("../css/maven-base.css");
@import url("../css/maven-theme.css");
@import url("../css/site.css");
</style>
<link rel="stylesheet" href="../css/print.css" type="text/css" media="print" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<?xml version="1.0" encoding="UTF-8"?>
<script type="text/javascript">var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));</script>
<?xml version="1.0" encoding="UTF-8"?>
<script type="text/javascript">var pageTracker = _gat._getTracker("UA-140879-5");
pageTracker._initData();
pageTracker._trackPageview();</script>
</head>
<body class="composite">
<div id="banner">
<a href="../../" id="bannerLeft">
<img src="http://archiva.apache.org/images/archiva.png" alt="" />
</a>
<a href="http://www.apache.org/" id="bannerRight">
<img src="http://www.apache.org/images/asf_logo_wide.png" alt="" />
</a>
<div class="clear">
<hr/>
</div>
</div>
<div id="breadcrumbs">
<div class="xleft">
<a href="http://www.apache.org/">Apache</a>
&gt;
<a href="../../../">Archiva</a>
&gt;
<a href="../index.html">1.3.9</a>
</div>
<div class="xright">
&nbsp;| Last Published: 01 Jul 2014
</div>
<div class="clear">
<hr/>
</div>
</div>
<div id="leftColumn">
<div id="navcolumn">
<h5>Introduction</h5>
<ul>
<li class="none">
<a href="../quick-start.html">Quick Start</a>
</li>
<li class="none">
<a href="../tour/index.html">Feature Tour</a>
</li>
<li class="none">
<a href="../release-notes.html">Release Notes</a>
</li>
<li class="none">
<a href="http://archiva.apache.org/download.html">Downloads</a>
</li>
</ul>
<h5>Users Guide</h5>
<ul>
<li class="none">
<a href="../userguide/browsing.html">Browsing</a>
</li>
<li class="none">
<a href="../userguide/searching.html">Searching</a>
</li>
<li class="none">
<a href="../userguide/find-artifact.html">Identifying an Artifact</a>
</li>
<li class="none">
<a href="../userguide/delete-artifact.html">Deleting an Artifact</a>
</li>
<li class="none">
<strong>Using as a repository</strong>
</li>
<li class="none">
<a href="../userguide/deploy.html">Deploying to repository</a>
</li>
<li class="none">
<a href="../userguide/virtual-repositories.html">Configuring Virtual Repositories</a>
</li>
<li class="none">
<a href="../userguide/rss.html">Rss Feeds in Archiva</a>
</li>
<li class="none">
<a href="../userguide/auditlog-report.html">Audit Log Report</a>
</li>
</ul>
<h5>Administrators Guide</h5>
<ul>
<li class="collapsed">
<a href="../adminguide/installing.html">Installing Archiva</a>
</li>
<li class="none">
<a href="../adminguide/databases.html">Databases</a>
</li>
<li class="collapsed">
<a href="../adminguide/security.html">Security</a>
</li>
<li class="collapsed">
<a href="../adminguide/configuration.html">Runtime Configuration</a>
</li>
<li class="none">
<a href="../adminguide/configuration-files.html">Configuration Files</a>
</li>
<li class="collapsed">
<a href="../adminguide/logging.html">Log Files</a>
</li>
<li class="none">
<a href="../adminguide/reports.html">Reports</a>
</li>
<li class="none">
<a href="../adminguide/web-services.html">Web Services</a>
</li>
</ul>
<h5>Customising Archiva</h5>
<ul>
<li class="none">
<a href="../customising/writing-consumer.html">Writing a Consumer Plugin</a>
</li>
</ul>
<h5>More Information</h5>
<ul>
<li class="none">
<a href="http://cwiki.apache.org/confluence/display/ARCHIVA/Index">Archiva Wiki</a>
</li>
</ul>
<a href="http://maven.apache.org/" title="Built by Maven" id="poweredBy">
<img alt="Built by Maven" src="../images/logos/maven-feather.png"></img>
</a>
</div>
</div>
<div id="bodyColumn">
<div id="contentBox">
<div class="section"><h2>Configuring Maven 2 to use an Archiva repository</h2><p>To get your local Maven 2 installation to use an Archiva proxy you need to add the repositories you require to your 'settings.xml'. This file is usually found in $<a name="user.dir">user.dir</a>/.m2/settings.xml (see the <a href="http://maven.apache.org/settings.html">Settings Reference</a>). </p><p>How you configure the settings depends on how you would like to utilise the repository. You can add the Archiva repository as an additional repository to others already declared by the project, or lock down the environment to only use the Archiva repositories (possibly proxying content from a remote repository).</p><div class="section"><h3>Locking down to only use Archiva</h3><p>If you would like Archiva to serve as the only repository used by your Maven installation, you can use the Maven mirror settings to force this behaviour.</p><p>First, you need to select the default repository to use when none is configured by adding the following to the <tt>settings.xml</tt> file:</p><div class="source"><pre>&lt;settings&gt;
...
&lt;mirrors&gt;
&lt;mirror&gt;
&lt;id&gt;archiva.default&lt;/id&gt;
&lt;url&gt;http://repo.mycompany.com:8080/archiva/repository/internal/&lt;/url&gt;
&lt;mirrorOf&gt;*&lt;/mirrorOf&gt;
&lt;/mirror&gt;
&lt;/mirrors&gt;
...
&lt;/settings&gt;</pre></div><p>With this in place, all repository requests will be sent to the internal repository (which by default is configured to proxy the central repository).</p><p>If you have separate Archiva repositories that you wish to use, you can add an extra mirror declaration as needed:</p><div class="source"><pre> ...
&lt;mirror&gt;
&lt;id&gt;archiva.apache.snapshots&lt;/id&gt;
&lt;url&gt;http://repo.mycompany.com:8080/archiva/repository/snapshots/&lt;/url&gt;
&lt;mirrorOf&gt;apache.snapshots&lt;/mirrorOf&gt;
&lt;/mirror&gt;
...</pre></div><p><b>WARNING:</b> Maven, as of version 2.0.8, does not properly report the correct URL in errors when a mirror is used - so although the Archiva instance is being consulted any error messages will still reflect the original URL described in the POM.</p></div><div class="section"><h3>Using Archiva as an additional repository</h3><p>You will need to add one entry for each repository that is setup in Archiva. If your repository contains plugins; remember to also include a &lt;pluginRepository&gt; setting.</p><ol type="1"><li>Create a new profile to setup your repositories<div class="source"><pre>&lt;settings&gt;
...
&lt;profiles&gt;
&lt;profile&gt;
&lt;id&gt;Repository Proxy&lt;/id&gt;
&lt;activation&gt;
&lt;activeByDefault&gt;true&lt;/activeByDefault&gt;
&lt;/activation&gt;
&lt;!-- ******************************************************* --&gt;
&lt;!-- repositories for jar artifacts --&gt;
&lt;!-- ******************************************************* --&gt;
&lt;repositories&gt;
&lt;repository&gt;
...
&lt;/repository&gt;
...
&lt;/repositories&gt;
&lt;!-- ******************************************************* --&gt;
&lt;!-- repositories for maven plugins --&gt;
&lt;!-- ******************************************************* --&gt;
&lt;pluginRepositories&gt;
&lt;pluginRepository&gt;
...
&lt;/pluginRepository&gt;
...
&lt;/pluginRepositories&gt;
&lt;/profile&gt;
...
&lt;/profiles&gt;
...
&lt;/settings&gt;</pre></div></li><li>Add your repository configuration to the profile<p>You can copy the repository configuration from the POM Snippet on the Archiva Administration Page for a normal repository. It should look much like:</p><div class="source"><pre> &lt;repository&gt;
&lt;id&gt;repository-1&lt;/id&gt;
&lt;url&gt;http://repo.mycompany.com:8080/archiva/repository/internal/&lt;/url&gt;
&lt;releases&gt;
&lt;enabled&gt;true&lt;/enabled&gt;
&lt;/releases&gt;
&lt;snapshots&gt;
&lt;enabled&gt;false&lt;/enabled&gt;
&lt;/snapshots&gt;
&lt;/repository&gt;</pre></div></li><li>Add the necessary security configuration<p>This is only necessary if the guest account does not have read access to the given repository.</p><div class="source"><pre>&lt;settings&gt;
...
&lt;servers&gt;
&lt;server&gt;
&lt;id&gt;repository-1&lt;/id&gt;
&lt;username&gt;{archiva-user}&lt;/username&gt;
&lt;password&gt;{archiva-pwd}&lt;/password&gt;
&lt;/server&gt;
...
&lt;/servers&gt;
...
&lt;/settings&gt;</pre></div></li></ol></div></div>
</div>
</div>
<div class="clear">
<hr/>
</div>
<div id="footer">
<div class="xright">&#169;
2006-2014
The Apache Software Foundation
</div>
<div class="clear">
<hr/>
</div>
</div>
</body>
</html>