views:

71

answers:

3

I've downloaded Spring 3.0.2 with dependencies and found that it contains 405 jar files. I usually keep third party libraries in a "lib" subdirectory, but there are so many Spring jars that it seems sensible to keep them separately so that they don't swamp the other libraries and to simplify version upgrades.

I suspect that I want to keep the full set of libraries in Subversion, but only deploy the subset that is actually used.

Do Spring users have a standard way to deal with this problem?

+4  A: 

The vast majority of the "dependencies" are unnecessary, it really is a "kitchen sink" distribution. I would suggest just putting the Spring JARs themselves into lib, and only add the others as and when you need them.

In fact, you can pick and choose which Spring JARS you need - it's split up into several, so that you can pick the appropriate ones. There should be a readme file in the distribution describing which JARs you need, and what they depend on.

skaffman
AngerClown
@AngerClown: Sure, if you use all those parts of Spring. Many people don't.
skaffman
Between skaffman's answer and AngerClown's comment I think the answer is that I can put the subset of the jars that I'm using into lib. If the number of spring jars gets out of hand then I'll have to think again. Thank you both.
richj
+1  A: 

If you build using Maven, you can specify that you require particular Spring libraries. Maven will download these and their declared dependencies into your local repository, and package those jars required into your final solution. You don't need to declare anything other than your top-level dependency on Spring.

Brian Agnew
Thank you for your reply. It wasn't quite what I was after this time, but interesting nonetheless. I wouldn't have thought of automating the library download. If you can tell it what version you want, and to get both sources and binaries and put them in a well known place - what a great idea!
richj
+2  A: 

If you insist on using Ant, you can use its companion, Ivy, for dependency management. Personally, I have been a fairly happy Maven user for years.

Hans Westerbeek
Thank you for your answer. I know Ant reasonably well, but I'm happy to learn something new and better. I'd like to avoid the deep tree structures associated with out-of-the-box Maven. It's only a small thing, but the extra typing and mouse-clicks annoy people out of all proportion to the apparent effort involved. Hudson/Ivy/Ant or Hudson/Maven would probably work pretty well at the moment. I'm working on a relatively new project. Spring is its first large dependency.
richj
At the risk of starting another Maven vs Ivy discussion, Maven does more out of the box but you have to be willing to give up some control. Ivy will do almost anything, but the build scripts will be custom, with an associated learning curve for new programmers. I use Ivy for one of my projects, and it took probably 25-30 hours to get everything the way I wanted it over the course of several months during other development work. That was coming in cold with no significant Ant work since 2002, so I was learning at the same time.
AngerClown