If you are using Maven in a corporate environment, then you probably need a repository manager. There are few program such as Archiva , Proximity or Maven Proxy are out there for options. For this article, I will use Archiva for demostration. Please check the refence below for more details about why choosing Archiva
A Maven repository manager acts as both a repository for your JAR files, and a proxy/cache between you and all those dodgy public repositories out there on the internet. So, when Maven asks for a new dependency, its first port of call is your local repository. If the JAR has already been downloaded, it will be stored in the Archiva repository, and you won’t need to download it from the internet. This is both faster and more reliable than downloading JAR files directly from the internet.
You can download Archiva from http://maven.apache.org/archiva/download.html for your preference. In this article, I will only briefly introduce how to install and use the web application.
- Create a directory in tomcat called archiva, at the same level as bin, conf, logs and the others.
- Copy the war file into the new directory
- Create a conf/Catalina/localhost/archiva.xml file with the following data (replace the database paths with a suitable location)
<?xml version="1.0" encoding="UTF-8"?>
<Resource name="jdbc/users" auth="Container" type="javax.sql.DataSource"
<Resource name="jdbc/archiva" auth="Container" type="javax.sql.DataSource"
<Resource name="mail/Session" auth="Container"
- Download the derby library for database management, mail library for email management and save them into common/lib directory
- The $appserver.base java property is used by the Archiva internal logging configuration to determine where to output its logs to. Open the Catalina.bat file and insert the following code into the line start with set JAVA_OPTS=%JAVA_OPTS%
The last two steps could be optional, if you only expect Archiva to provide an HTTP access of the repository.
Run your tomcat application server and set up your account information. Then you need to redirect your WebDAV URL to the directory of your internal repository.
With Archiva, you can also add additional repositories. The accessible URL will in the following format
http://%5BURL TO ARCHIVA]/repository/[REPOSITORY ID]
Add your Repository to maven
Your repository can be simply added by inserting the following tag into either your pom or settings file.
If you think Archiva brought you too much work to manage your repository (although I would never agree), you can simply added your repository directory to the maven configuration file. Note: It is double backward slashes.
<id>Mycompnay internal </id>