Setting Up a Maven Repository
Tag it:

Setting Up a Maven Repository  - By Avneet M at TSS

 1. Introduction

Maven is a popular build tool available for java developers. One of the benefits of maven is that helps to reduce the duplication of dependent software libraries (jars) required to build an application. The maven suggested approach is to store all the software libraries in a remote store called a repository.

Maven synchronizes with the public repository at This repository is slow, unreliable and does not have the latest versions of some libraries(jars) available elsewhere. Libraries private to the organization cannot be uploaded there either. By setting up an internal maven repository, an organization can avail of the benefits of a maven repository and bypass some of the shortcomings of the repository at ibiblio.

This article looks at some of the functionality that a maven repository should provide. Criteria for choosing a maven repository are listed. Steps involved in setting up a maven repository using Artifactory are explained. The process of setting up the repository is same for both Linux and Windows and the minor differences are highlighted in the article. Examples of maven ‘pom’ files which use this repository are shown. The article is illustrated with screenshots to guide the user in setting up a repository. Sample maven and artifactory configuration is shown.

Setting Up a Maven Repository 1.1 Background knowledge

It is assumed that the reader is familiar with the following concepts and technologies:

  • Maven 2
  • JEE web servers deployment process (e.g. deploying web applications to Tomcat)
  • XML
1.2 Purpose of maven repository

The purpose of maven repository is to serve as an internal private repository of all software libraries used within an organization. Storing maven artefacts(jars and poms) in a dedicated maven repository is preferable to storing them in version control systems(such as CVS or Subversion) for the following reasons:

  • Libraries(jars) are binary files and don’t belong in version control systems which are better at handling text files
  • Keeps the version control database small
  • Checkouts, updates and other actions on the version control system will be quicker