Archiva

1. Download Archiva from http://archiva.apache.org/.

2. Unzip Archiva into a directory. On my Windows box, I extracted it to: C:\java\apache-archiva-1.1

3. Choose a destination location for the repo, config, logs, etc (so that you don't loose them during upgrades). Create this directory and set the environment variable ARCHIVA_HOME to it. In my case, that was: U:\private\archiva

4. Create $ARCHIVA_HOME/conf, $ARCHIVA_HOME/logs, $ARCHIVA_HOME/data

5. Copy the files from the archiva install directory's configuration directory (ie: C:\java\apache-archiva-1.1\conf\*.*) into the new configuration directory (ie: U:\private\archiva\conf)

6. Edit the $ARCHIVA_HOME/conf/jetty.xml to have the port you would like to use. I don't keep the default 8080 because then it conflicts with other installs before I have a chance to save them...
     <Call name="addConnector">
      <Arg>
          <New class="org.mortbay.jetty.nio.SelectChannelConnector">
            <Set name="host"><SystemProperty name="jetty.host"/></Set>
            <Set name="port"><SystemProperty name="jetty.port" default="8090"/></Set>
            <Set name="maxIdleTime">30000</Set>
            <Set name="Acceptors">2</Set>
            <Set name="statsOn">false</Set>
            <Set name="confidentialPort">8443</Set>
        <Set name="lowResourcesConnections">5000</Set>
        <Set name="lowResourcesMaxIdleTime">5000</Set>
          </New>
      </Arg>
    </Call>

7. Start archiva.  The instructions tell you how to use 'archiva install' and 'archiva start' but I could not get that to work. It would install and it would start but it would immediately die without any known reason given in the logs... So, instead, I have a dedicated dos prompt set up for 'archiva console'.  If you are concerned about it not running automatically when Windows starts up, then put a shortcut to it in your Startup folder (ie: C:\Documents and Settings\mdeaelfweald\Start Menu\Programs\Startup).

8. Go to the webpage for it.  You could use http://localhost:8090/archiva [replacing the port with the one in step #6] but I prefer to also replace localhost with the machine name so that it is obvious what url to use with other machines on the network. Ie: http://mymachine:8090/archiva.  Once you go there, it will require that you setup your admin account.

9. Create a new account (ie: not admin) that you will use to access Archiva from Maven. You'll use the username and password in step #13.

10. Under Managed Repositories, setup any additional remote proxies you are currently using in your maven projects.  I setup ibiblio and the legacy java.net maven repo. 

11. Under Proxy Connectors, link the new repos (step #10) under the 'internal' (Archiva Managed Internal Repository) repository. Based on the pre-existing ones, I set my settings for the new proxies to:
 Managed Repository
 internal
 Cache Failures
 yes
 Releases once
 Snapshots never

12. Under Repository Groups, create a new identifier.  In this example, we are calling it 'myrepo'. Under this virtual repository, make sure to link both the 'internal' and 'snapshot' repositories.

13. Configure Maven to use Archiva for all its access. Create a settings.xml file as such (replacing the username and password):
<!-- in C:\Documents and Settings\username\.m2\settings.xml -->
<!-- in ~/.m2/settings.xml -->
<settings>
  <localRepository/>
  <servers>
    <server>
      <id>archiva.default</id>
      <username>username</username>
      <password>password</password>
    </server>
  </servers>
  <mirrors>
    <mirror>
      <id>archiva.default</id>
      <url>http://mymachine:8090/archiva/repository/myrepo</url>
      <mirrorOf>*</mirrorOf>
    </mirror>
  </mirrors>
  <profiles>
    <profile>
      <id>Default</id>
      <activation>
        <activeByDefault>true</activeByDefault>
      </activation>
      <repositories>
        <repository>
          <id>archiva.default</id>
          <url>http://
mymachine:8090/archiva/repository/myrepo</url>
        </repository>
      </repositories>
    </profile>
  </profiles>
</settings>
The username and password are as were defined in the User Management section of Archiva's administration page. (step #9)

The mymachine:8090 are your machine name and the port specified in the $ARCHIVA_HOME/conf/jetty.xml (step #6)
IE:
<Set name="port"><SystemProperty name="jetty.port" default="8090"/></Set>

The myrepo is as defined in the Respository Groups section of the Archiva's administration page. (step #12)

14. If you had previously used Maven, then get rid of your old maven repository to force it to download all the jars again.  In my case, I simply renamed
C:\Documents and Settings\mdeaelfweald\.m2\repository
to
C:\Documents and Settings\mdeaelfweald\.m2\eld-repository

15. Build your maven project.  It will take quite awhile to re-download all the artifacts the first time, but Archiva will cache them locally thus making future access (even by others on the network) faster.

16. If it fails to find any artifacts, you will probably need to install them. This can be done in the Upload Artifact section.

Enabling snapshot uploads:
1. Go into Repositories, find the "Archiva Managed Snapshot Repository" (snapshot) and click on 'Show POM Snippet'. It will show something like this:
 
<project>
...
<distributionManagement>
<snapshotRepository>
<id>snapshots</id>
<url>dav:http://
mymachine:8090/archiva/repository/snapshots/</url>
</snapshotRepository>
</distributionManagement>

<repositories>
<repository>
<id>snapshots</id>
<name>Archiva Managed Snapshot Repository</name>
<url>http://
mymachine:8090/archiva/repository/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
...
</project>

2. Add the <distributionManagement> portion into your project's pom.xml

3. Add the <repository> portion into your settings.xml that we created earlier.

4. In your settings.xml, copy the 'archiva.default' server configuration and change the copies id to match the one in this POM snippet (in this case: 'snapshots')

5. mvn deploy

ċ
settings.xml
(1k)
Malachi de Ælfweald,
Jul 24, 2008, 2:43 PM
Comments