Maven Artifacts

Up to this point the Spring Portfolio Maven artifacts, especially the snapshots, were inconsitently created and scattered about in various locations. Over the past couple of weeks, we've been working to get the projects to be more consistent in the creation and uploading of these artifacts.
Maven Repositories
One of the most useful improvements to the Maven support in the Spring Portfolio is the use of consistent repository locations. There are three different repositories depending on your level of comfort with the code.
Release Repository
For any final release (Spring 2.5, Spring Web Flow 2.0, etc.) the Maven artifacts for that release will be uploaded to the Maven Central repository (http://repo1.maven.org/maven2). Using this repository requires no effort on your part as Maven will automatically look for artifacts there.
The artifacts in this repository do follow expected repository behaviors and will not (and cannot) not be removed.
Milestone Repository
For any milestone release (Spring 2.5-RC1, Spring Web Flow 2.0-M2, etc.) the Maven artifacts for that release will be uploaded to the the Spring Milestone repository (http://s3.amazonaws.com/maven.springframework.org/milestone). Using this repository requires you to add an entry to the <repositories/> element in your POM. It should look like this:
<id>spring-milestone</id>
<name>Spring Portfolio Milestone Repository</name>
<url>http://s3.amazonaws.com/maven.springframework.org/milestone</url>
</repository>
The artifacts in this repository do not follow expected repository behaviors and will be removed regularly. Upon the release of a final version (Spring 2.6, Spring Web Flow 2.1, etc.) all milestone versions from the previous release of an artifact will be removed. For example, when Spring 2.6 is released, Spring 2.5 milestones will be removed while Spring 2.6 milestones will be retained.
Snapshot Repository
For any snapshot build (Spring 2.5-SNAPSHOT, Spring Web Flow 2.0-SNAPSHOT, etc.) the Maven artifacts for that build will be uploaded to the Spring Snapshot repository (http://s3.amazonaws.com/maven.springframework.org/snapshot). Using this repository requires you to add an entry to the <repositories/> element in your POM. It should look like this:
<id>spring-snapshot</id>
<name>Spring Portfolio Snapshot Repository</name>
<url>http://s3.amazonaws.com/maven.springframework.org/snapshot</url>
</repository>
The artifacts in this repository do not follow expected repository behaviors and will be removed regularly. At least the last 10 snapshot builds for a given artifact will be retained. If an artifact is removed from a distribution its snapshot builds will be removed immediately. On the release of a milestone or a final release, all snapshots for an artifact will be removed and a new snapshot for the next release created.
Repository Browsing
The milestone and snapshot repositories are both hosted on Amazon's S3 service and as such the directory structure is not human-readable. To view the repositories in a human-readable format, use the S3Browse utility.
- Milestone Repository: http://s3browse.com/explore/maven.springframework.org/milestone
- Snapshot Repository: http://s3browse.com/explore/maven.springframework.org/snapshot
Only use these URLs for human-readable viewing. If you use them as the URLs for your POMs you will encounter errors.
Artifact Sources
Another important improvement is the addition of source artifacts for all releases. You will notice in the milestone repository all artifacts have sources deployed with them. This will also be true as we go forward for all final releases as well. Specifically, starting with the Spring 2.5 release, in addition to the combined Spring sources, each module will also have a source artifact.
Spring Snapshots
The final improvement is one that isn't yet complete; a nightly snapshot of Spring. I'm pleased to say that this is close to being completed. I'm still working out the final kinks with respect to the Maven Ant Tasks but this will eventually start showing up and I'll announce it again when it does. As well, you can expect this functionality to eventually make its way out to all of the other ANT-based Spring Portfolio projects so that all projects will create Maven snapshots as well as milestones.
Created

Carlos Sanchez says:
Added on September 18th, 2007 at 12:19 pmnice!
Martin Bengl says:
Added on September 18th, 2007 at 2:21 pmyoho! thanks a lot (especially for the source attachments) - maven rocks!
Erick Dovale says:
Added on September 18th, 2007 at 3:24 pmThe source attachments is a biggie for me too..
Thanks a lot and keep it up!!!
Russell Healy says:
Added on September 18th, 2007 at 4:12 pmGood stuff, thanks!
Narada says:
Added on September 19th, 2007 at 3:31 amThis is fantastic news. I'd been feeling the need for non-final releases lately and now I can integrate seamlessly using maven without setting up my own repositories. Thanks! Out of curiosity what the driving motivation to use aws as opposed to normal hosting?
Ben Hale (blog author) says:
Added on September 19th, 2007 at 7:42 am[quote post="221"]Out of curiosity what the driving motivation to use aws as opposed to normal hosting?[/quote]
Cost mostly. If you take a look at the S3 service it's at $0.18/GB for bandwidth and $0.15/GB-month for storage. So for what ends up being very low cost, we get a distributed architecture that has high download speeds all over the world rather than just locally from whatever box we would happen to be hosting on.
Peter Bona says:
Added on September 21st, 2007 at 3:37 amChecking spring-webmvc-2.1-m4.pom I see that the dependency on Servlet API is scoped as 'provided'. Why is the provided scope? I am trying to compile something with maven with simple dependency on spring-webmvc-2.1-m4, but it fails because maven assumes I provide that jar, so it doesn't download it. I understand that typical web apps will provide the Servlet API, but they can (and should) create the 'provided' dependency, not you. Any advice?
Ben Hale (blog author) says:
Added on September 21st, 2007 at 6:41 am[quote post=\"221\"] but it fails because maven assumes I provide that jar, so it doesn\'t download it.[/quote]
To quote from the Maven documentation:
[quote]provided - this is much like compile, but indicates you expect the JDK or a container to provide it. It is only available on the compilation classpath, and is not transitive.[/quote]
So if we were to build Spring with Maven, it would download the servlet-api for us to compile against, but if you depend on Spring, it does not come along as a transitive dependency. If you\'re getting a compile error, it\'s because your code depends on the servlet-api directly and you should declare it as a direct dependency in your POM. In this case, I\'d recommend that you declare your servlet-api dependency as \'provided\' as well as the container will provide it at runtime.
This is true for all of your direct dependencies of course. You should never take advantage of the side effects of transitive dependency resolution, you never know when those dependencies will change underneath you.
Peter Bona says:
Added on September 21st, 2007 at 8:56 amOk. I didn't understand what 'transitive' here meant. Thanks for helping.
Chris Beams says:
Added on September 21st, 2007 at 11:52 pmBen,
Thanks - I'm looking forward to the nightly build support. In the meantime, what's the recommended approach for getting hold of them? Build from source?
Chris Beams says:
Added on September 22nd, 2007 at 12:37 am[quote comment="50515"]Ben,
What's the recommended approach for getting hold of [nightly builds]?[/quote]
Just figured this out (thanks, Ramnivas): http://static.springframework.org/downloads/nightly/snapshot-download.php?project=SPR
Ben Hale (blog author) says:
Added on September 24th, 2007 at 9:16 am[quote post="221"]Thanks - I'm looking forward to the nightly build support. In the meantime, what's the recommended approach for getting hold of them?[/quote]
If you download the -with-dependencies snapshots, there is a `maveninstall` target that will actually install the artifacts to your local maven repo as well.
Chris Beams says:
Added on September 24th, 2007 at 7:45 pm[quote post="221"]If you download the -with-dependencies snapshots, there is a `maveninstall` target that will actually install the artifacts to your local maven repo as well.[/quote]
That was very helpful, Ben. Just saved me a bunch of time, thanks.
Joerg Bellmann says:
Added on October 25th, 2007 at 4:34 pmHi,
i tried to get spring-javaconfig 1.0-m3-SNAPSHOT but it doesnt work.
My repository-section in pom.xml
spring-s3-snapshots
default
http://s3.amazonaws.com/maven.springframework.org/snapshot
spring-milestone
Spring Portfolio Milestone Repository
http://s3.amazonaws.com/maven.springframework.org/milestone
My dependencies-section:
org.springframework.javaconfig
spring-javaconfig
1.0-m3-SNAPSHOT
Did i miss something.
Browsing is possible and i see the files, but maven can not download it.
Thanks
Jörg
Tony says:
Added on November 5th, 2007 at 2:38 pmGreat with the sources. Since I use 2.0.x, and will for a long time, I would really appreciate if you uploaded sources to the 2.0.x versions as well.
Regards
Ben Hale (blog author) says:
Added on November 6th, 2007 at 11:29 amWell, the 2.0 branch doesn't actually build individual source packages so it's very problematic for us to add them (basically I do it by hand when I have to) so I don't think that 2.0 will ever get anything other than the full JAR sources.
As Spring 2.5 is intended to be a drop in replacement for 2.0 in most cases, I encourage you to try it once it is released. It and all further releases will will have sources.
Ivan says:
Added on December 19th, 2007 at 3:02 pmWhen i resolve Spring 2.5 jar and dependencies with ivy from mavenRepo1 i always get a mismatch between the expected and the computed sha1 hashs
pp says:
Added on December 20th, 2007 at 5:05 amhttp://repo1.maven.org/maven2
I don't see any repository for spring 2.5 or may be I am blind ?
Ben Hale (blog author) says:
Added on December 20th, 2007 at 7:33 amIt's in there with a group id of 'org.springframework'. If you check in the http://repo1.maven.org/maven2/org/springframework/spring area you'll see the JARs themselves.
Tinko says:
Added on December 30th, 2007 at 7:38 amHi,
i use ivy to resolve the spring 2.5 dependencies from http://repo1.maven.org/maven2.
The thing is that it looks like something is not right with the sha1 hash of the jar.
I always get
[ivy:retrieve] WARN: [FAILED ] org.springframework#spring;2.5!spring.jar: invalid sha1: expected=43ee30f7ea8fcdaff8f0e14ce423e7717d7eb776 computed=159082f4e937a9ce4a459703c7fb64f5e6d2a1ee (13446ms) thanks tinko
Ari says:
Added on February 13th, 2008 at 12:45 amHi Ben,
I'm using Maven 2.0.8 with Spring 2.5.1. Do you know why I needed to explicitly add the dependency for commons-dbcp to my POM? It is already listed in the spring-2.5.1.pom I see in my local repository:
commons-dbcp
commons-dbcp
1.2.2
true
… but for some reason, it wasn't brought down with all the other dependencies. When I put it in my own project's POM, it came down fine, along with its dependency commons-pool. Any ideas?
Thanks,
Ari
Ben Hale (blog author) says:
Added on February 13th, 2008 at 3:29 am[quote post="221"]Do you know why I needed to explicitly add the dependency for commons-dbcp to my POM?[/quote]
Many (if not most) of the dependencies in the Spring POM are marked as optional. Maven does not retrieve optional dependencies during transitive dependency resolution.
Ari says:
Added on February 15th, 2008 at 7:01 pmAh, I see now — thanks.
Ari