At my company we are using Archiva, it is by far the simplest Repository Manager to set up and maintain. Especially if you go with the stand-alone based version. The each developer just sets up a profile
in their ~/.m2/settings.xml
file to point to the internal repository. If this is too much trouble, just put the internal repository in the <repositories/>
in the pom.xml
directly, but that is really bad practice. If the repository url ever moves, you have to update all your projects pom.xml
files. Where as using settings.xml
puts that burden on the developer to update their local configuration.
<?xml version="1.0" encoding="UTF-8"?>
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
<profiles>
<profile>
<id>internal</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<repositories>
<repository>
<id>mycompany.internal</id>
<name>Internal Release Repository</name>
<url>http://maven.mycompany.com/repository/internal/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
<repository>
<id>mycompany.snapshots</id>
<name>Internal Snapshot Repository</name>
<url>http://maven.mycompany.com/repository/snapshots/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>
</profiles>
<servers>
<server>
<id>internal</id>
<username>guest</username>
</server>
<server>
<id>snapshots</id>
<username>guest</username>
</server>
</servers>
</settings>
If setting up a Repository Manager is too much trouble, I think you need to reconsider the alternative of manually adding stuff to your local repository by hand, which is very error prone and time consuming. I run an Archiva instance for my personal development just because it is so easy to add the release
plug in and manage versions without having to remember all the arcane -D
options required to add stuff to your local repository on every machine. Copying the ~/.m2/settings.xml
file is super easy and if it works on one machine it works on all of them.
Here is what you add to your pom.xml
to enable automatically doing releases and pushing artifacts to a repository, in my case it is Archiva.
<distributionManagement>
<repository>
<id>internal</id>
<name>Internal Archiva Repository</name>
<url>http://maven.mycompany.com/repository/internal/</url>
<layout>default</layout>
<uniqueVersion>false</uniqueVersion>
</repository>
<snapshotRepository>
<id>snapshots</id>
<name>Internal Archiva Repository</name>
<url>http://maven.mycompany.com/repository/snapshots/</url>
<layout>default</layout>
<uniqueVersion>false</uniqueVersion>
</snapshotRepository>
</distributionManagement>
Then all you do is mvn clean release:prepare
to automatically update your pom.xml
version check in, tag and optionally branch the release and package all the artifacts, and then mvn release:perform
to push the artifacts to the remote repository and check in the newly versioned pom.xml
and you are ready for the next version to start development.
Snapshots got to snaphots
and Releases go to internal
automatically with the release plug in. You do have to configure the scm plug in as well, but that is just a few lines of configuration that you only have to touch once as well.
This is what it looks like for git, we are using Gitorious as our git Repository Manager
<scm>
<connection>scm:git:git://gitorious.mycompany.com:myproject/myproject.git</connection>
<developerConnection>scm:git:ssh://git@gitorious.mycompany.com/myproject/myproject.git</developerConnection>
<url>http://gitorious.mycompany.com/myproject/myproject</url>
</scm>
An old desktop computer running Linux can handle repository duties like this for a development team without having to involve procurement and IT.