views:

85

answers:

2

I'm doing some Spring development and I'm trying to decide if libraries should always be kept in the application lib, even if they end up being common to more than one app. Doesn't Tomcat startup slowdown if a bunch of jar files end up in the common/lib? I'm also fearful of versions and dependencies. Isn't that less of a problem if the application maintains its own copy of everything? Are there going to be occasions where Tomcat absolutely needs a library to be in common/lib because the jar is specific to the functionality of the container and not really the application?

+3  A: 

I tend towards keeping libraries common to the application, and not being shared.

If you have more than one application using these libraries, and you have to upgrade a library (for a feature, or a bug fix), then you're going to have to retest (perhaps even recompile/deploy) all those applications.

Keeping libraries with the applications means that you're not locked into testing all your apps if you need to change just the one. Each application is effectively sandboxed.

(you may find for speed of development that it helps to share the common libraries in your development environment. However that's distinct from the final deployment scenario)

Brian Agnew
+4  A: 

Unless there is very good reason to make them common, then keep individual copies for each application.

You may run into VERY nasty classloader problems if you make them common.

Thorbjørn Ravn Andersen
+1 In my experience you will run into nasty classloader problems, and you will find them very hard to reproduce and diagnose.
Rich Seller