Apache Maven 1.x has reached its end of life, and is no longer supported. For more information, see the announcement. Users are encouraged to migrate to the current version of Apache Maven.

Internal Repositories

When using Maven, particularly in a corporate environment, connecting to the internet to download dependencies is not acceptable for security, speed or bandwidth reasons. For that reason, it is desirable to set up an internal repository to house a copy of artifacts, and to publish private artifacts to.

Such an internal repository can be downloaded from using HTTP or the file system (using a file:// URL), and uploaded to using SCP, FTP, or a file copy.

Note that as far as Maven is concerned, there is nothing special about this repository: it is another remote repository that contains artifacts to download to a user's local cache, and is a publish destination for artifact releases.

Additionally, you may want to share the repository server with your generated project sites. For more information on creating and deploying sites, see Creating a Site.

Setting up the Internal Repository

To set up an internal repository just requires that you have a place to put it, and then start copying required artifacts there using the same layout as in a remote repository such as Ibiblio.

It is not recommended that you scrape or rsync:// a full copy of Ibiblio as there is a large amount of data there. You can use a program such as Maven Proxy, running on your internal repository's server, to download from the internet as required and then hold the artifacts in your internal repository for faster downloading later.

The other options available are to manually download and vet releases, then copy them to the internal repository, or to have Maven download them for a user, and manually upload the vetted artifacts to the internal repository which is used for releases. This step is the only one available for artifacts where the license forbids their distribution automatically, such as several J2EE JARs provided by Sun. Refer to the Standard Sun JAR Names document for more information.

It should be noted that Maven intends to include enhanced support for such features in the future, including click through licenses on downloading, and verification of signatures.

Using the Internal Repository

Using the internal repository is quite simple. Simply set the maven.repo.remote property in your project's properties:

maven.repo.remote=http://repository.company.com/
  or
maven.repo.remote=file:///shared/repository

Deploying to the Internal Repository

One of the most important reasons to have one or more internal repositories is to be able to publish your own private releases to share.

To publish to the repository, you will need to have access via one of SCP, SFTP, FTP, or the filesystem. For example, to set up an SCP transfer, you define the following properties:

maven.repo.list=myrepo
maven.repo.myrepo=scp://repository.mycompany.com/
maven.repo.myrepo.directory=/www/repository.mycompany.com/
maven.repo.myrepo.username=${user.name}
maven.repo.myrepo.privatekey=${user.home}/.ssh/id_dsa
        

With this configured, the *:deploy goals will now send the published artifacts to the "remote" repository for sharing. This includes jar:deploy, dist:deploy, war:deploy and so on.

For more information, please refer to the Artifact Plugin Reference and the section on Making Releases.