Installing the standalone distribution of Archiva is quite simple - for an example, see the Quick Start guide.
However, the best way to use this installation technique is to separate the configuration from the installation to make it easy to upgrade to newer versions in the future.
Archiva can be run by executing:
On Windows, to use the start and stop commands you must first install it as a service. This is done by running:
.\bin\archiva install
You can then use the start and stop commands as well as the traditional Windows service management console to manage the Archiva service.
This procedure installs the service to run as the local system user. You must ensure that it has access to read the installation, and to write to the logs and data directories.
You can later remove the service with:
.\bin\archiva remove
The standalone instance of Archiva uses the Plexus application server, which is capable of separating it's configuration from installation, in much the same way Tomcat does for example.
This is achieved by the following steps:
Archiva's configuration is loaded from the following files, in order of most precedent:
When Archiva saves it's configuration, all configuration is stored to a single file. The file chosen is by the following rules:
The configuration will never be saved in the Archiva installation directory if you are using a separate base directory.
Note that the configuration can be edited, but only when Archiva is not running as it will not reload a changed configuration file, and will save over it if something is changed in the web interface.
By default, Archiva uses embedded Apache Derby to store the user information. It can be configured to use an external database by providing a JDBC driver and editing the jetty.xml file.
The example below uses Mysql for the database server. You can take a look at Archiva with MySQL for more details.
... <!-- Archiva Database --> <New id="archiva" class="org.mortbay.jetty.plus.naming.Resource"> <Arg>jdbc/archiva</Arg> <Arg> <New class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"> <Set name="serverName">localhost</Set> <Set name="databaseName">archiva</Set> <Set name="user">archiva</Set> <Set name="password">sa</Set> </New> </Arg> </New> <New id="archivaShutdown" class="org.mortbay.jetty.plus.naming.Resource"> <Arg>jdbc/archivaShutdown</Arg> <Arg> <New class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"> <Set name="serverName">localhost</Set> <Set name="databaseName">archiva</Set> <Set name="user">archiva</Set> <Set name="password">sa</Set> </New> </Arg> </New> <!-- Users / Security Database --> <New id="users" class="org.mortbay.jetty.plus.naming.Resource"> <Arg>jdbc/users</Arg> <Arg> <New class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"> <Set name="serverName">localhost</Set> <Set name="databaseName">redback</Set> <Set name="user">archiva</Set> <Set name="password">sa</Set> </New> </Arg> </New> <New id="usersShutdown" class="org.mortbay.jetty.plus.naming.Resource"> <Arg>jdbc/usersShutdown</Arg> <Arg> <New class="com.mysql.jdbc.jdbc2.optional.MysqlDataSource"> <Set name="url">jdbc:mysql://localhost/redback</Set> <Set name="user">archiva</Set> <Set name="password">sa</Set> </New> </Arg> </New> ...
More information about using Derby Network Server as an external user database for Archiva can be found on the wiki: Archiva User DB on Derby Network Server
Upgrading Archiva is straightforward if the directions for separating the base from the installation above are followed. Simply retain the data/repositories and data/databases/users directories, and the configuration files (in the conf directory, or the other locations specified above) and use a new extracted installation of Archiva.
Note that the users database must always be retained as it contains the permissions and user information across versions. However, in order to take advantage of the improvements in search in Archiva 1.1 (and higher versions), s.a. search by java class/package/method, the archiva database must be re-created. So you need to delete the data/databases/archiva directory, delete the .index directories of your respective repositories, and execute the repository and database scanners after starting Archiva.
The repository data is portable across versions, and multiple versions can be configured to look at the same repositories (though not run simultaneously).
Because of the changes in the search implementation in 1.2, a few additional steps need to be performed when upgrading Archiva from 1.x to 1.2. Since the format of the index has changed in 1.2, the old index directory (which is located at /path/to/repo/.index by default) needs to be removed. And in order for the artifacts in the repository to be indexed again, the last modified date of the artifacts need to be updated. To do this, just execute find [REPOSITORY_DIRECTORY_NAME] | xargs touch at the base directory where the repository resides. Execute the repository scanning so that the new index will be generated.