Spring Maven Repositories

1. Overview

This article will show what Maven Repositories to use when using Spring artifacts in a project – see the full list of repositories on the Spring wiki. The previous SpringSource artifact management infrastructure was maven.springframework.org – this has now been deprecated in favour of the more powerful repo.springsource.org.

2. Maven Releases

All the GA/Release artifacts are published to Maven Central, so if only releases are needed, there is no need to add any new repo into the pom. There is however a custom, browsable Maven repository available for Spring Releases as well, if for some reason Central is not available:

<repositories>
    <repository>
        <id>repository.springsource.release</id>
        <name>SpringSource GA Repository</name>
        <url>http://repo.springsource.org/release</url>
    </repository>
</repositories>

The Spring artifact versioning rules are explained on the project wiki.

Milestones and Snapshots are not published directly to Maven Central, so these have their own specific repos.

3. Maven Milestones and Release Candidates

For Milestones and RCs, the following repo needs to be added to the pom:

<repositories>
    <repository>
        <id>repository.springsource.milestone</id>
        <name>SpringSource Milestone Repository</name>
        <url>http://repo.springsource.org/milestone</url>
    </repository>
</repositories>

One this repository has been defined, the project can start using the Spring milestone dependencies:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>4.0.0.M3</version>
</dependency>

4. Maven Snapshots

Similar to milestones, Spring Snapshots are hosted in a custom repository:

<repositories>
    <repository>
        <id>repository.springsource.snapshot</id>
        <name>SpringSource Snapshot Repository</name>
        <url>http://repo.springsource.org/snapshot</url>
    </repository>
</repositories>

Once the repository is enabled in the pom, the project can start the using Spring snapshots:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>3.2.7.BUILD-SNAPSHOT</version>
</dependency>

And even:

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-core</artifactId>
    <version>4.0.1.BUILD-SNAPSHOT</version>
</dependency>

The snapshot repositories can now also be browsed.

5. Maven Repository for Spring OSGI

OSGI compatible Spring artifacts are maintained in the SpringSource Enterprise Bundle Repository – in short, EBR. These repositories contains valid OSGI bundles and libraries for the entire Spring Framework, as well as a complete set of dependencies for these libraries. For bundles:

<repository>
    <id>com.springsource.repository.bundles.release</id> 
    <name>SpringSource Enterprise Bundle Repository - SpringSource Bundle Releases</name> 
    <url>http://repository.springsource.com/maven/bundles/release</url> 
</repository>

<repository> 
    <id>com.springsource.repository.bundles.external</id> 
    <name>SpringSource Enterprise Bundle Repository - External Bundle Releases</name> 
    <url>http://repository.springsource.com/maven/bundles/external</url> 
</repository>

And for OSGI compatible libraries:

<repository>
    <id>com.springsource.repository.libraries.release</id>
    <name>SpringSource Enterprise Bundle Repository - SpringSource Library Releases</name>
    <url>http://repository.springsource.com/maven/libraries/release</url>
</repository>
<repository>
    <id>com.springsource.repository.libraries.external</id>
    <name>SpringSource Enterprise Bundle Repository - External Library Releases</name>
    <url>http://repository.springsource.com/maven/libraries/external</url>
</repository>

6. Conclusion

This article describes the practical information about setting up Spring specific Maven Repositories in the pom – in order to use Release Candidates, Milestones and Snapshots.

I usually post about Spring stuff on Google+ - you can follow me there:

 

GET THE 3 EBOOKS >>
Download the 3 eBooks - Build Your App "The Right Way"
×
Build Your Web App with Spring (and quickly prototype it to 90%)

,