Configuring Apache Archiva with Tomcat 7

Apache Archiva is a repository manager that is capable of proxying other repositories. (By default it will proxy Maven Central). Archiva is useful for large builds such as Big Top as the ~4.1GB of Maven artifacts from all over the internet can be centralised in a more controlled place within Linaro. This means that if one of the many servers glitches; our CI builds still progress forwards.

There is a standalone version of Apache Archiva, but this requires a native Java Service Wrapper (JSW) to launch.

One can also configure Apache Archiva to run inside Apache Tomcat. This page details how this can be accomplished on Debian Jessie with Apache Tomcat 7.


  • sudo apt-get install apache-tomcat7

  • wget

  • wget

Deployment instructions

These were loosely based on the ones at:

  • Set up directory for Archiva to reside:

cd /var/lib/tomcat7
sudo mkdir archiva
sudo cp ~/apache-archiva-2.2.0.war archiva
sudo mkdir archiva/conf
sudo touch archiva/conf/archiva.xml
sudo chown -Rv tomcat7:tomcat7 archiva
  • Create /var/lib/tomcat7/conf/Catalina/localhost/archiva.xml:

<?xml version="1.0" encoding="UTF-8"?>
<Context path="/archiva"

<Resource name="jdbc/users" auth="Container" type="javax.sql.DataSource"
           url="jdbc:derby:/var/lib/tomcat7/archiva/user-database;create=true" />

<Resource name="mail/Session" auth="Container"

  • Create /usr/share/tomcat7/bin/

# I used the latest JDK from Linaro, this may not be needed
export JAVA_HOME="/var/lib/linaro-java/jdk8-server-release-1510"

# Let Archiva know where it is
export CATALINA_OPTS="-Dappserver.home=$CATALINA_BASE/archiva -Dappserver.base=$CATALINA_BASE/archiva"

# I needed to beef up the maximum heap size
export JAVA_OPTS="-Xmx4G"
  • Add pre-requisite libraries to Tomcat7, these come from the apache-archiva-2.2.0-bin.tar.gz.

    • tar xvf apache-archiva-2.2.0-bin.tar.gz

    • cd apache-archiva-2.2.0/lib

    • sudo cp derby- /usr/share/tomcat7/lib/

    • sudo cp activation-1.1.jar /usr/share/tomcat7/lib

    • sudo cp mail-1.4.jar /usr/share/tomcat7/lib

  • We are now ready to start tomcat7 with sudo service tomcat7 start

  • Wait until the CPU usage dies down for the java process.
  • A quick wget can test to see if everything is working:
    • wget http://<SERVERIP>:8080/archiva/repository/internal/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar

  • If the wget succeeds everything is good!

If things go wrong

There are a lot of moving parts with Tomcat and Archiva, and a slight typo/variation in initial conditions may necessitate some debugging. The following two files should be inspected if anything goes wrong:

  • /var/log/tomcat7/catalina.out

  • /var/lib/tomcat7/archiva/logs/archiva.log

Keep an eye out for OutOfMemoryErrors as these will require some raising of the parameters in

Running inside a Docker container

I ran this in a Jessie Docker container on AArch64 and noticed that when I ran service tomcat7 start the startup scripts reported an error. Looking closer, Tomcat7 was actually started successfully though and Archiva ran fine.

The archiva web-ui

One can see things graphically by browsing to: http://SERVERIP:8080/archiva

Hooking up Apache Big Top Build to Archiva


One can redirect Maven via the file ~/.m2/settings.xml





Ivy is tricky as the configuration is per project and I've not found any way to override this. There are some commits being worked on in the Linaro ODPI Big Top tree that automatically override the ivysettings.xml files with the one stored at ~/ivysettings.xml. A sample configuration can be found below:

<?xml version="1.0" encoding="UTF-8"?>
<settings defaultResolver="archiva" />
<property name="archiva-internal"
    value="http://<SERVERIP>:8080/archiva/repository/internal" />
    <ibiblio name="archiva" m2compatible="true" root="${archiva-internal}" />

Extra Archiva remote repositories needed for Apache Big Top

The following extra remote repositories needed to be connected to the internal repository (central was connected by default):











LEG/Engineering/BigData/configuring-archiva-with-tomcat7 (last modified 2016-03-21 23:04:39)