------ Using as a Repository ------ Configuring Maven 2 to use an Archiva repository 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 ${user.dir}/.m2/settings.xml (see the {{{http://maven.apache.org/settings.html}Settings Reference}}). 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). * Locking down to only use Archiva 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. First, you need to select the default repository to use when none is configured by adding the following to the <<>> file: +-------------------------------------------------------------------------+ ... archiva.default http://repo.mycompany.com:8080/archiva/repository/internal/ * ... +-------------------------------------------------------------------------+ With this in place, all repository requests will be sent to the internal repository (which by default is configured to proxy the central repository). If you have separate Archiva repositories that you wish to use, you can add an extra mirror declaration as needed: +-------------------------------------------------------------------------+ ... archiva.apache.snapshots http://repo.mycompany.com:8080/archiva/repository/snapshots/ apache.snapshots ... +-------------------------------------------------------------------------+ <> 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. * Using Archiva as an additional repository 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 \ setting. [[1]] Create a new profile to setup your repositories +-------------------------------------------------------------------------+ ... Repository Proxy true ... ... ... ... ... ... +-------------------------------------------------------------------------+ [[2]] Add your repository configuration to the profile You can copy the repository configuration from the POM Snippet on the Archiva Administration Page for a normal repository. It should look much like: +-------------------------------------------------------------------------+ repository-1 http://repo.mycompany.com:8080/archiva/repository/internal/ true false +-------------------------------------------------------------------------+ [[3]] Add the necessary security configuration This is only necessary if the guest account does not have read access to the given repository. +-------------------------------------------------------------------------+ ... repository-1 {archiva-user} {archiva-pwd} ... ... +-------------------------------------------------------------------------+