It took me way longer than I wanted to set up a simple maven project using the Spring M4 and the latest snapshot of Spring Integration. For some reason this is not documented prominently on
springframework.org. I commit on Spring Integration, so maybe I should do something about this, on the other hand, blogging is easier... I'll hand you the fix that still worked for me in 2009.
I'm a bit of a maven rookie. I've been using it for years now, but I still feel uncomfortable using it and I have given up on ever having a complete grasp of how it works. The general idea and functionality I understand and sympathize with, but other than that it's too painful to recommend. On the other hand, I just want my build to work and learning Gradle isn't on the top of my list if I need to get started
now. Maven itself is tolerable but the plugin and repository landscape isn't.
I'm just going to save you 45 (if not more) minutes of searching and cursing before you find hints on the project pages.
Don't use the search tools for maven central (I like
mvnrepository) for Spring dependencies.
Don't use SpringSources enterprise repository for milestones and snapshots. They might be there, but they end up there later than on S3.
There is a milestone and snapshot repository in S3, as described by Ben Hale in a
blog. Use the repository snippets from that blog (also included here). Look carefully at the url of the s3browser.
Do use http://s3browse.com/explore/maven.springframework.org/The repositories are in s3, and while that is very cool, it's also a pain for you because you can't explore them with the url copied from the repository element. Keep a comment on that in your pom if you have colleagues.
<repository>
<id>spring-milestone</id>
<name>Spring Portfolio Milestone Repository</name>
<url>http://s3.amazonaws.com/maven.springframework.org/milestone</url>
<!-- browse via http://s3browse.com/explore/maven.springframework.org/milestone -->
</repository>
<repository>
<id>spring-snapshot</id>
<name>Spring Portfolio Snapshot Repository</name>
<url>http://s3.amazonaws.com/maven.springframework.org/snapshot</url>
<!-- browse via http://s3browse.com/explore/maven.springframework.org/snapshot -->
</repository>
If you need artifacts from S2's enterprise repository too you can end up with a whopping 6 repository snippets just for your spring artifacts. Keeping track of which artifact comes from which can be daunting. If you're in the position to do so, using
Nexus (or similar) can be used to mitigate that.
There are a lot more details to all this (related to OSGi and maven versioning schemes), but if you're just interested in making it work, you should be grand now.
Hope this helps.