Obtaining Spring 3 Artifacts with Maven

A recent commentor here ragged, "It's only half of the world that's using Maven", when pointing out it is not obvious how to obtain Spring 3 artifacts with Maven. In this entry, I'll show you how to do this and what the options are. This information will also be integrated into the reference documentation of the upcoming Spring 3 final release.
Maven Repositories where Spring Artifacts are Published
In general, Spring publishes its artifacts to two different places:
- Maven Central, which is the default repository Maven queries, and does not require any special configuration to use
- The Enterprise Bundle Repository (EBR), which is run by SpringSource and also hosts all the libraries that integrate with Spring
So the first thing you need to decide when obtaining Spring with Maven is which place you'll get it from. In general, if you care about OSGi, use our EBR, since it houses OSGi compatible artifacts for all of Spring's dependencies, such as Hibernate and Freemarker. If OSGi does not matter to you, either place works, though there are some pros and cons between them. In general, pick one place or the other for your project; do not mix them. This is particularly important since EBR artifacts use a different naming convention than Maven Central artifacts.
Below is a table that compares Maven Central to the EBR in several areas:
| Feature | Maven Central | Enterprise Bundle Repository (EBR) |
|---|---|---|
| OSGi Compatible | No | Yes |
| Number of Artifacts | Tens of thousands; all kinds | Hundreds; those that Spring integrates/supports |
| Consistent Naming Conventions for all Artifacts? | No | Yes |
| Artifact Naming Convention |
Group id Varies; newer artifacts use domain name e.g. "org.sl4j"; older artifacts use artifact id e.g. "log4j" Artifact id |
Group id <Domain name> e.g. "org.springframework" Artifact id <Bundle-SymbolicName>, derived from main package e.g. "org.springframework.beans". If the JAR had to be patched to ensure OSGi compliance, "com.springsource." is prepended e.g. "com.springsource.org.apache.log4j" Version OSGi version number format of <major>.<minor>.<micro>[.qualifier] e.g. "3.0.0.RC3" |
| Publishing | Automatic (rSync via remote repositories) | Manual (JIRA processed by SpringSource) |
| Quality Assurance | None I am aware of; Accuracy is responsibility of publishing organization | Extensive (for both MANIFEST.mf and .pom); QA is performed by Spring Team |
| Hosting | @ Contegix funded by Sonatype with several mirrors | S3 funded by SpringSource |
| Search Utilities | Various | www.springsource.com/repository |
| Integrated with SpringSource Tools (STS, Roo, CloudFoundry) | Yes, with STS | Yes, with STS, Roo, and CloudFoundry |
Speaking personally, I tend to prefer EBR because of the consistent artifact naming conventions, the high accuracy of the artifact metadata, and the fact that all the artifacts there are useful for Spring-based application development. I find when I use EBR I have cleaner POMs with less exclusions, and the naming conventions make artifacts easier to find. I also take comfort knowing that Spring itself builds from the EBR.
Now that you know the options, I'll discuss how to obtain Spring artifacts from both places.
Obtaining Spring Releases From Maven Central
You do not have to add a repository to your .pom to obtain final releases of Spring projects from Maven Central. Simply add the dependencies your project requires.
A .pom <dependency> snippet for each Spring Framework 3 artifact as it will be indexed in Maven Central is listed below.
<!-- Shared version number properties -->
<properties>
<org.springframework.version>3.0.0.RELEASE</org.springframework.version>
</properties>
<!--
Core utilities used by other modules.
Define this if you use Spring Utility APIs (org.springframework.core.*/org.springframework.util.*)
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!--
Expression Language (depends on spring-core)
Define this if you use Spring Expression APIs (org.springframework.expression.*)
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-expression</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!--
Bean Factory and JavaBeans utilities (depends on spring-core)
Define this if you use Spring Bean APIs (org.springframework.beans.*)
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!--
Aspect Oriented Programming (AOP) Framework (depends on spring-core, spring-beans)
Define this if you use Spring AOP APIs (org.springframework.aop.*)
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aop</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!--
Application Context (depends on spring-core, spring-expression, spring-aop, spring-beans)
This is the central artifact for Spring's Dependency Injection Container and is generally always defined
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!--
Various Application Context utilities, including EhCache, JavaMail, Quartz, and Freemarker integration
Define this if you need any of these integrations
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!--
Transaction Management Abstraction (depends on spring-core, spring-beans, spring-aop, spring-context)
Define this if you use Spring Transactions or DAO Exception Hierarchy
(org.springframework.transaction.*/org.springframework.dao.*)
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!--
JDBC Data Access Library (depends on spring-core, spring-beans, spring-context, spring-tx)
Define this if you use Spring's JdbcTemplate API (org.springframework.jdbc.*)
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!--
Object-to-Relation-Mapping (ORM) integration with Hibernate, JPA, and iBatis.
(depends on spring-core, spring-beans, spring-context, spring-tx)
Define this if you need ORM (org.springframework.orm.*)
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!--
Object-to-XML Mapping (OXM) abstraction and integration with JAXB, JiBX, Castor, XStream, and XML Beans.
(depends on spring-core, spring-beans, spring-context)
Define this if you need OXM (org.springframework.oxm.*)
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-oxm</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!--
Web application development utilities applicable to both Servlet and Portlet Environments
(depends on spring-core, spring-beans, spring-context)
Define this if you use Spring MVC, or wish to use Struts, JSF, or another web framework with Spring (org.springframework.web.*)
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!--
Spring MVC for Servlet Environments (depends on spring-core, spring-beans, spring-context, spring-web)
Define this if you use Spring MVC with a Servlet Container such as Apache Tomcat (org.springframework.web.servlet.*)
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!--
Spring MVC for Portlet Environments (depends on spring-core, spring-beans, spring-context, spring-web)
Define this if you use Spring MVC with a Portlet Container (org.springframework.web.portlet.*)
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc-portlet</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!--
Support for testing Spring applications with tools such as JUnit and TestNG
This artifact is generally always defined with a 'test' scope for the integration testing framework and unit testing stubs
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${org.springframework.version}</version>
<scope>test</scope>
</dependency>
Obtaining Spring Releases From The Enterprise Bundle Repository (EBR)
To obtain final releases of Spring projects from the EBR, add the following repositories to your .pom:
<repository>
<id>com.springsource.repository.bundles.release</id>
<name>EBR Spring Release Repository</name>
<url>http:// repository.springsource.com/maven/bundles/release</url>
</repository>
<repository>
<id>com.springsource.repository.bundles.external</id>
<name>EBR External Release Repository</name>
<url>http:// repository.springsource.com/maven/bundles/external</url>
</repository>
Then simply add the dependencies your project requires, keeping in mind the EBR artifact naming conventions.
A .pom <dependency> snippet for each Spring Framework 3 artifact as it will be indexed in the EBR is listed below:
<!-- Shared version number properties -->
<properties>
<org.springframework.version>3.0.0.RELEASE</org.springframework.version>
</properties>
<!--
Core utilities used by other modules.
Define this if you use Spring Utility APIs (org.springframework.core.*/org.springframework.util.*)
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.core</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!--
Expression Language (depends on core)
Define this if you use Spring Expression APIs (org.springframework.expression.*)
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.expression</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!--
Bean Factory and JavaBeans utilities (depends on core)
Define this if you use Spring Bean APIs (org.springframework.beans.*)
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.beans</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!--
Aspect Oriented Programming (AOP) Framework (depends on core, beans)
Define this if you use Spring AOP APIs (org.springframework.aop.*)
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.aop</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!--
Application Context (depends on core, expression, aop, beans)
This is the central artifact for Spring's Dependency Injection Container and is generally always defined
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.context</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!--
Various Application Context utilities, including EhCache, JavaMail, Quartz, and Freemarker integration
Define this if you need any of these integrations
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.context.support</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!--
Transaction Management Abstraction (depends on core, beans, aop, context)
Define this if you use Spring Transactions or DAO Exception Hierarchy
(org.springframework.transaction.*/org.springframework.dao.*)
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.transaction</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!--
JDBC Data Access Library (depends on core, beans, context, transaction)
Define this if you use Spring's JdbcTemplate API (org.springframework.jdbc.*)
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.jdbc</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!--
Object-to-Relation-Mapping (ORM) integration with Hibernate, JPA, and iBatis.
(depends on core, beans, context, transaction)
Define this if you need ORM (org.springframework.orm.*)
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.orm</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!--
Object-to-XML Mapping (OXM) abstraction and integration with JAXB, JiBX, Castor, XStream, and XML Beans.
(depends on core, beans, context)
Define this if you need OXM (org.springframework.oxm.*)
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.oxm</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!--
Web app development utilities common across Servlet/Portlet environments (depends on core, beans, context)
Define this if you use Spring MVC, or wish to use Struts, JSF, or another web framework with Spring (org.springframework.web.*)
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.web</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!--
Spring MVC for Servlet Environments (depends on core, beans, context, web)
Define this if you use Spring MVC with a Servlet Container such as Apache Tomcat (org.springframework.web.servlet.*)
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.web.servlet</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!--
Spring MVC for Portlet Environments (depends on core, beans, context, web)
Define this if you use Spring MVC with a Portlet Container (org.springframework.web.portlet.*)
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.web.portlet</artifactId>
<version>${org.springframework.version}</version>
</dependency>
<!--
Support for testing Spring applications with tools such as JUnit and TestNG
This artifact is generally always defined with a 'test' scope for the integration testing framework and unit testing stubs
-->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.test</artifactId>
<version>${org.springframework.version}</version>
<scope>test</scope>
</dependency>
Obtaining Spring Milestone Releases
Milestones and Release Candidates may not be published directly to Maven Central, and in general are published separately from final releases. SpringSource hosts two repositories for obtaining Spring milestones. The first one should be used in conjunction with Maven Central, and the second one in conjunction with the EBR.
Obtaining Milestones from the Maven Central Compatible Repository
To obtain Spring milestones from the Maven Central compatible repository, add the following repository to your .pom:
<repository>
<id>org.springframework.maven.milestone</id>
<name>Maven Central Compatible Spring Milestone Repository</name>
<url>http:// maven.springframework.org/milestone</url>
</repository>
The milestone version number format is <major>.<minor>.<micro>.M#; for example, 3.0.0.M4. The release candidate version number format is <major>.<minor>.<micro>.RC#; for example, 3.0.0.RC3.
For example, adding the following dependency would retrieve version 3.0.0.RC3 of the spring-context artifact:
<dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>3.0.0.RC3</version> </dependency>
Obtaining Milestones from the Enterprise Bundle Repository (EBR)
To obtain Spring milestones from the EBR, add the following repository to your .pom:
<repository>
<id>com.springsource.repository.bundles.milestone</id>
<name>EBR Spring Milestone Repository</name>
<url>http:// repository.springsource.com/maven/bundles/milestone</url>
</repository>
Be sure to keep in mind the distinct EBR artifact naming convention. For example, adding the following dependency would retrieve version 3.0.0.RC3 of the org.springframework.context artifact:
<dependency> <groupId>org.springframework</groupId> <artifactId>org.springframework.context</artifactId> <version>3.0.0.RC3</version> </dependency>
Obtaining Nightly Spring Snapshots
Snapshots of Spring projects are published each night, allowing users to verify that reported issues have been resolved before the next release. Like Milestones, there is a separate Maven Central compatible snapshot repository and an EBR snapshot repository.
Obtaining Snapshots from the Maven Central Compatible Repository
To obtain Spring nightly snapshots from the Maven Central compatible repository, add the following repository to your .pom:
<repository>
<id>org.springframework.maven.snapshot</id>
<name>Maven Central Compatible Spring Snapshot Repository</name>
<url>http:// maven.springframework.org/snapshot</url>
</repository>
The snapshot version format is <major>.<minor>.<micro>.BUILD-SNAPSHOT; for example, 3.0.1.BUILD-SNAPSHOT.
For example, adding the following dependency would retrieve the latest snapshot of the spring-context artifact:
<dependency> <groupId>org.springframework</groupId> <artifactId>spring-context</artifactId> <version>3.0.1.BUILD-SNAPSHOT</version> </dependency>
Notice the <major>.<minor>.<micro>.BUILD-SNAPSHOT format differs slightly from the traditional Maven 2 snapshot format of <major>.<minor>.<micro>-SNAPSHOT. This is because x.y.z-SNAPSHOT is not a valid OSGi version number. All Spring projects now follow the OSGi version numbering scheme (Maven 3 will as well).
Obtaining Snapshots from the Enterprise Bundle Repository (EBR)
To obtain Spring nightly snapshots from the EBR, add the following repository to your .pom:
<repository>
<id>com.springsource.repository.bundles.snapshot</id>
<name>EBR Spring Snapshot Repository</name>
<url>http:// repository.springsource.com/maven/bundles/snapshot</url>
</repository>
As an final example, adding the following dependency would retrieve the latest snapshot of the org.springframework.context artifact:
<dependency> <groupId>org.springframework</groupId> <artifactId>org.springframework.context</artifactId> <version>3.0.1.BUILD-SNAPSHOT</version> </dependency>
Spring Project Productivity Tools
I would like to close with a brief note about the tooling Spring provides for projects that use Maven. Both the SpringSource Tool Suite and Spring Roo provide wizards that can generate new Spring projects with pre-configured .poms. Roo goes quite far in this regard–it can actually manage your .pom for you as you execute code generation commands that require additional artifacts to be downloaded.
Cloud Foundry also has a new capability that allows cloud deployments to be made sans external dependencies, greatly reducing deployment times. To make this work, Cloud Foundry syncs with the EBR after publishing to complete a deployment.
Summary
Whew, that was quite a lot of ground to cover.
This was a long entry, but in summary, I hope it is now clear how to obtain Spring artifacts with Maven, whether you are seeking a final release, a milestone, a release candidate, or a nightly snapshot. Making Spring easy to get your hands on is very important to us. It's particularly important in a project's milestone phase, when users are trying out new functionality for the first time and have the opportunity to directly influence Spring's direction.
Similar Posts
- Spring Framework Maven Artifacts
- Maven PAR Plugin 1.0.0.M1
- Maven Artifacts
- Infrastructure changes in Spring 2.1-m2
- Logging Dependencies in Spring











Erik says:
Added on December 2nd, 2009 at 4:32 amJust a typo: the hyperlink under "Search Utilities" in the table to the SpringSource Enteprise Bundle Repository is incorrect (the href doesn't match the text description).
Erik-Berndt Scheper says:
Added on December 2nd, 2009 at 6:21 amAny chance you can add the same information for Apache Ivy?
Martin Vanek says:
Added on December 2nd, 2009 at 6:30 amNice. Yesterday I've made attempt to move from classic maven libs to osgi bundles.
After nondefault translations
spring-webmvc -> org.springframework.web.servlet
and
spring-tx -> org.springframework.transaction
I've hit problem that spring security 3.0.0.CI-SNAPSHOT and spring webflow 3.0.0.BUILD-SNAPSHOT are not present in EBR Spring Snapshot Repository. Well my SNAPSHOT need is only temporary in run for 3.0.0.
Keith Donald (blog author) says:
Added on December 2nd, 2009 at 8:06 amErik,
Typo fixed – nice catch.
Keith Donald (blog author) says:
Added on December 2nd, 2009 at 8:08 amErik-Berndt,
Good question about Ivy. EBR is also natively ivy compatible, and of course Ivy itself can read Maven repositories. Yes, we will add documentation for Ivy usage in the upcoming Spring 3 final release.
Keith
Arnaud Héritier says:
Added on December 2nd, 2009 at 8:47 amHi Keith,
For your information, Apache never hosted central repository. It was at ibiblio.org for several years, before to move to specific hardware hosted and managed by Contegix.
Cheers,
Arnaud
Keith Donald (blog author) says:
Added on December 2nd, 2009 at 8:54 amArnaud,
Thanks, that is useful information and I've updated the blog accordingly. Do you know how the hosting of the central repository is funded?
Keith
Arnaud Héritier says:
Added on December 2nd, 2009 at 9:16 amIt was with donation Jason Van Zyl received, and I suppose that nowadays Sonatype helps also. I'll ask to Jason to reply here. He better knows that than myself.
Cheers.
Keith Donald (blog author) says:
Added on December 2nd, 2009 at 10:50 amThanks Arnaud!
I look forward to hearing from Jason. In general, I bet there's a lot of insight he can provide to continue to improve upon the Maven Central / EBR comparison table in this entry.
Cheers,
Keith
Martin says:
Added on December 2nd, 2009 at 12:02 pm1 for Ivy
Jason van Zyl says:
Added on December 2nd, 2009 at 12:56 pmI'll write a more thorough response, but as far as Maven Central it has been hosted at Contegix since 2005. Sonatype, in one form or another, has paid for the hosting fees, bandwidth and the vast majority of labour required to maintain it. Contegix is also very generous in that they give us a pretty healthy discount on hosting and bandwidth as they see collaborating with OSS projects as good business. So Maven Central has had production quality, 24/7 support and servicing from Contegix for a long time now. Contegix are now experts at helping manage Maven Central and Nexus Pro. We also use Amazon S3 to publish the very popular Nexus Index which is currently integrated into tools like STS, M2Eclipse, IDEA, and Netbeans. So the hosting is a combination of Contegix and S3.
The Maven PMC also has access to Maven Central and a couple folks like Arnaud, and Carlos help submit bundles, but Brian Fox does the day-to-day maintenance of managing nginx and Nexus Pro. Blocking scrapers, helping projects get setup with syncing through http://oss.sonatype.org, and helping OSS forges like Apache, Codehaus, eXo, and Hippo manage their Nexus Pro instances.
I've always considered it an important part of sustaining the Maven eco-system and it only becomes healthier as we pick up mirrors and have more OSS forges use Nexus which is really helping improve quality of artifacts submitted to Maven Central. I talk more about this in my blog entry.
Jason van Zyl
Founder, Apache Maven
Founder, Sonatype
Jason van Zyl says:
Added on December 2nd, 2009 at 2:52 pm@keith, Note that suggesting consumers put repositories in their POMs is an anti-pattern for enterprise Maven builds. It's really not a good idea. Here's a reference for you: http://www.sonatype.com/people/2009/02/why-putting-repositories-in-your-poms-is-a-bad-idea/.
You might want to suggest using a repository manager like Nexus with a setup like this: http://screencast.com/t/ZWNhNzMxZmE where you can have the individual Spring repos and then group them together like this: http://screencast.com/t/NDQ5Mjkz in an order from releases, milestones, to snapshots. This way build and release folks don't put repositories in POMs and they can be managed in a centralized, best-practices fashion. Using a single group in Nexus is usually very handy: http://www.sonatype.com/books/nexus-book/reference/maven-sect-single-group.html
Jason van Zyl
Founder, Apache Maven
Founder, Sonatype
Willie Wheeler says:
Added on December 3rd, 2009 at 1:17 amHi Keith. Here are a couple of suggestions for you to consider for the 3.0.0 reference documentation.
1) One thing I've found very useful for Spring apps is to use Maven properties instead of hardcoding the Spring version. Like this:
<dependency>
<groupId>org.springframework</groupId>
<artifactId>org.springframework.test</artifactId>
<version>${spring.version}</version>
<scope>test</scope>
</dependency>
…
<properties>
<spring.version>3.0.0.RC3</spring.version>
</properties>
This is useful for Spring because Spring has a lot of JARs. (Though I'm sufficiently OCD about DRY that I'll do it even if there are only two coordinated JARs.)
That way you can upgrade to a new version with a single change.
2) If you are using Maven modules then the <dependencyManagement> feature is great, because again you can define all the versions and even scope in a top-level POM (using properties say) and then just reference the group/artifact IDs (no version, no scope) from the modules.
Yoav Landman says:
Added on December 3rd, 2009 at 5:03 amAs an organizational repository manager, you can also use JFrog's Artifactory, which is not only a Maven repository, but also an Ivy one – not only in terms of artifact resolution/deployment support, but also in the way it allows you to search inside Ivy modules and extract Ivy dependencies.
Artifactory also supports proxying the Spring remote repositories out-of-the-box (as well as other common remote repositories), by extracting the repository definitions from our REST service, including the correct include/exclude patterns so that you avoid hitting the Spring repository for common artifacts which are there but are not Spring-related.
Avishay Halperen says:
Added on December 3rd, 2009 at 7:28 amKeith,
I manage a very large project with over 150 modules which relays heavily on maven as the build tool, and uses spring as long as other 3rd party frameworks.
I am spring enthusiastic and I think modularizing the spring framework is a good way to go.
The need for a local repository manager is essential for managing both the local artifacts and the third party artifacts.
Connecting directly from the pom itself to a remote repository such as spring or repo1 is a bad choice.
We are using Artifactory to do that. All the configuration to spring repository and to other repositories as well (such as jboss,terracota,repo1 etc..)
is done inside Artifactory.
Once you do that (connect directly to Artifactory and configure the remote repos there) you have the ability to control on which repository to get stuff from.
I found out that this control on which artifacts you receive from where is very critical to our build process, especially when you need multiple repositories for building your project and you can't rely on a remote repository such as repo1 to be 24/7 available for you.
I don't think there is actually any other way to go.
I agree with you that using repo1 is the last resort, I really prefer using a well managed remote repository such as jfrog or springsource – but this just strengthen the fact that the need of an in-house Artifactory is essential.
Tetsuo says:
Added on December 3rd, 2009 at 10:51 amHow can we browse these repositories?
Guy says:
Added on December 3rd, 2009 at 2:55 pmHello Keith,
I've tried using EBR for several days, its has simple UI and is kept up-to-date of course. That's almost everything a developer needs; however, download time is quite exhausting when establishing new projects on several computers (each computer downloads its own artifacts).
I chose to use a local mirror/repository (Artifactory for that matter, for its simplicity) for hosting your artifacts, especially at times when new releases are made available on weekly or monthly bases.
Spring 3.0.0 is a great product. Keep up the good work.
Sam Brannen says:
Added on December 4th, 2009 at 7:04 amFYI: the FAQ for the SpringSource Enterprise Bundle Repository (EBR) is also quite useful:
http://www.springsource.com/repository/app/faq
The FAQ contains further detailed information regarding artifacts in the repository as well as Ivy and Maven configuration settings (as discussed in this blog entry).
Regards,
Sam
Sam Brannen says:
Added on December 4th, 2009 at 9:35 amAnd… don't forget about testing.
Spring's testing support can be included from Maven Central as:
org.springframework
spring-test
3.0.0.RELEASE
test
And from EBR as:
org.springframework
org.springframework.test
3.0.0.RELEASE
test
* NOTE: when using EBR to retrieve your JUnit and TestNG dependencies, you will run into problems with Maven's Surefire plug-in if you fail to manually override the default value for junitArtifactName or testNGArtifactName. See the following JIRA issue for details:
https://issuetracker.springsource.com/browse/EBR-220
Regards,
Sam
Sam Brannen says:
Added on December 4th, 2009 at 9:37 amLooks like the blog's filter ate my XML angle brackets. So hopefully you can discern which lines correspond to Maven's dependency, groupId, artifactId, version, and scope elements.
Regards,
Sam
Rick Herrick says:
Added on December 7th, 2009 at 4:51 pmThanks for the article, very helpful in getting us to adopt 3.0 from 2.5 more easily! We're moving from 2.5/Maven Repo to using 3.0.0.* from the EBR to facilitate OSGi compatibility (luckily, we're also moving to Java and Spring from C#/.NET, so we have no legacy code or environments we need to support
.
I ran into one issue when making these changes and I'm posting the solution just in case anyone else runs into it. I added the EBR milestone repo to my pom.xml, changed the artifact IDs and version to get the 3.0.0.R3 bundles, and saved the pom.xml out (in STS, it automatically runs Maven on save). I got the following error:
12/7/09 3:25:46 PM CST: Missing indirectly referenced artifact org.aopalliance:com.springsource.org.aopalliance:jar:1.0.0:compile
So I added a bundle for this per this link: http://bit.ly/60hcxx. Then I got the error message:
12/7/09 3:29:26 PM CST: Missing artifact org.aopalliance:com.springsource.org.aopalliance:jar:1.0.0:compile
The fix for this is to add not just the milestone repo, but the release and external repos as well. This means you'll have three EBR Spring repositories:
* EBR Spring Release Repository
* EBR External Release Repository
* EBR Spring Milestone Repository
I'm not sure if it's the release or external release repo that fixes this issue. My guess is the external release repo, but I put them both in and that works as well
Shlomi says:
Added on December 14th, 2009 at 10:35 amUse Artifactory
http://java.dzone.com/articles/maven-repository-manager-nexus
Cameron says:
Added on December 15th, 2009 at 12:14 amThis is a great post.
Its fantastic to have this information all in one place.
Gene De Lisa says:
Added on December 17th, 2009 at 8:01 amA rarity: A blog post that is actually useful.
Thank you.
Keith Donald (blog author) says:
Added on December 17th, 2009 at 10:40 amRick,
Yes, to retrieve "external" artifacts such as aopalliance and Hibernate from EBR, you need the external repository. In general, you'll always need "release" for full Spring releases such as 3.0.0.RELEASE, and "external" for supported Spring integrations. Then, if you would also like to access "milestone" or "snapshot" (s), you'll need those as well.
Glad you guys found this article useful!
godsmilk says:
Added on December 17th, 2009 at 1:57 pmthere's a typo in line 063 of the pom.xml snippet…
thanks for the very thorough maven post!
Keith Donald (blog author) says:
Added on December 17th, 2009 at 3:07 pmNot seeing a typo there? Perhaps you have an older version cached – the site caches content for up to 12 hours it seems.
Cody Burleson says:
Added on December 20th, 2009 at 3:16 amThe typo is to k's in the word springframwork (instead of one):
063. ${org.springframeworkk.version}
Keith Donald (blog author) says:
Added on December 20th, 2009 at 11:06 pmThanks – fixed!
j pimmel says:
Added on January 9th, 2010 at 6:26 pmI've been trying every single repo published in the docs by SpringSource and not one of them is responding to HTTP requests.. Anyone aware of this?
The following repos aren't responding at the time of writing – they all appear to resolve to inside Amazon AWS and nothing is responding…
http://repository.springsource.com/maven/bundles/external
http://repository.springsource.com/maven/bundles/release
http://s3browse.com/explore/maven.springframework.org/release/org/springframework/batch
Youbs says:
Added on January 11th, 2010 at 5:54 amAnother typo:
§ Obtaining Spring Releases From The Enterprise Bundle Repository (EBR) :
Line 12 : 3.0.0.RELEASE
(should be 3.0.0.RELEASE )
Youbs says:
Added on January 11th, 2010 at 6:02 amOoops, I meant :
Line 3 : spring.version should be org.springframework.version
Matt says:
Added on January 19th, 2010 at 5:58 amOne question: I just tried obtaining a nightly snapshot via the Central Repository (which you said is updated automatically via rsync), but it downloaded a build with the version 3.0.1.BUILD-20100113.112134-2, which is nearly a week old. Any idea what might be going on there?
Cheers
Srini says:
Added on January 20th, 2010 at 5:16 pmHi Guys,
Spring 3.0.0.RELEASE as a single bundle is missing in the central repository
http://repo2.maven.org/maven2/org/springframework/spring/
org.springframework
spring
3.0.0.RELEASE
runtime
This seems to be not wroking
Stevo Slavic says:
Added on January 20th, 2010 at 5:41 pmSrini, see answer here: http://forum.springsource.org/showthread.php?p=279422
Keith Donald (blog author) says:
Added on January 23rd, 2010 at 1:30 pmThanks for all the comments here, you've really helped make the post be as good and accurate as it can be. I've incorporated all the spotted typos, etc.
Enjoy Spring 3!
Keith
vini says:
Added on February 8th, 2010 at 6:15 pmIs there any test application with spring mvc 3.0 and freemarker ?
Please provide the link..
Thanks in adv.
Matthew Moore says:
Added on February 8th, 2010 at 9:07 pmWhy did you guys choose to use a version number for 3 (3.0.0.RELEASE) which does not abide by Maven's rules for version numbers? In a nutshell, if your version number is not of the form ..-, Maven can't perform any range operations when resolving versions. This is causing issues with third party projects that use version ranges to express dependencies on Spring. Thanks.
Matthew Moore says:
Added on February 8th, 2010 at 9:37 pmAck, the blog ate my meta-characters. Anyhow, you can find a good discussion of Maven versioning here: http://www.sonatype.com/books/mvnref-book/reference/pom-relationships-sect-pom-syntax.html#pom-reationships-sect-versions