tags:

views:

613

answers:

4

What are the main/best Maven repositories to use that will include the majority of your open source Java package dependencies.

Also in what order should these be included? Does it matter?

+6  A: 

This is the current setup in the project we are building:

  • MavenCentral
  • ObjectWeb
  • JBoss Maven2
  • and some snapshots (see below)

    <repository>
        <id>MavenCentral</id>
        <name>Maven repository</name>
        <url>http://repo1.maven.org/maven2&lt;/url&gt;
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>objectweb</id>
        <name>Objectweb repository</name>
        <url>http://maven.objectweb.org/maven2&lt;/url&gt;
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>jboss</id>
        <name>JBoss Maven2 repository</name>
        <url>http://repository.jboss.com/maven2/&lt;/url&gt;
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
        <releases>
            <enabled>true</enabled>
        </releases>
    </repository>
    <repository>
        <id>glassfish</id>
        <name>Glassfish repository</name>
        <url>http://download.java.net/maven/1&lt;/url&gt;
        <layout>legacy</layout>
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>apache.snapshots</id>
        <name>Apache Snapshot Repository</name>
        <url>
            http://people.apache.org/repo/m2-snapshot-repository
        </url>
        <releases>
            <enabled>false</enabled>
        </releases>
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>ops4j.repository</id>
        <name>OPS4J Repository</name>
        <url>http://repository.ops4j.org/maven2&lt;/url&gt;
        <releases>
            <enabled>true</enabled>
        </releases>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
    <repository>
        <id>Codehaus Snapshots</id>
        <url>http://snapshots.repository.codehaus.org/&lt;/url&gt;
        <snapshots>
            <enabled>true</enabled>
        </snapshots>
        <releases>
            <enabled>false</enabled>
        </releases>
    </repository>
    
smink
+3  A: 

I would suggest using a Maven proxy like Archiva, Artifactory or Nexus and defining your repo list on the server side. The order matters only to the extent that the proxy server tries the proxied repos one by one and specifying a fringe repository as first will slow down the resolution of uncached artifacts (Artifactory allows you to specify whitelist and blacklist expressions for each proxied repo, which solves this problem)

Overall using your own repo gives you more control and reliable builds ('central' is often painfully slow). It also gives you a place to put your own artifacts and any non-free 3rd party artifacts.

ddimitrov
Great idea. The only caveat I would add is that if you are releasing your project as open source then you should explicitly list the external repository dependencies in your POM.
bmatthews68
+2  A: 
  1. Apache Snapshot Repository and
  2. Codehaus Snapshot Repository

Use Nexus as your internal Repo and enable remote Index Downloads from the main online repositories.

Dan