So we have this cool feature called transitive dependencies in maven 2. For those that don’t know yet that allows me to say:
- me: I want struts 1.2.8 in my webapp, do it!
- maven: sure, I add struts-1.2.8, but as I know you’re a bit lazy I’ll add for you commons-beanutils, commons-digester, jakarta oro,… because I know you’ll need them
- me: cool, I still remember those days when I had to download the jars by hand and put them in a folder in cvs and then create a classpath in ant,…
- maven: no problem
But then something happens with some of the jars:
- me: I want to use spring-hibernate 1.2.5
- maven: you again? I’ll add spring-hibernate-1.2.5, but as it depends in other stuff, I’ll add also spring-orm and its dependencies, hibernate-annotations, hibernate 2, hibernate 3,…
- me: wait! how is that you’re adding hibernate 2 and 3? I want to use just 3!!
- maven: well, if you wanna use all the features in spring-hibernate you’ll need both or you may get a ClassNotFoundException. There’s no way I can know what will you use and what not.
- me: let me think, if I had created a spring-hibernate2 and spring-hibernate3, I could depend on spring-hibernate3 and everything would be automatic
- maven: yes, but shit happens, and that’s not how it was released
- me: ok, then let’s tag hibernate 2 and 3 as optional in the spring-hibernate pom in ibiblio, that way I don’t need to exclude hibernate2, although I’ll need to add also hibernate3 to my dependencies.
- maven: that will be hard for a lazy bastard like you
- me: stfu!
To sum up this is my advice: the days of downloading jars and adding them to a folder ended time ago, don’t be worried about creating more smaller jars that explicitly define their dependencies with no doubt, meaning that you’ll always know the requirements of a piece of software. Avoid big jars that depend on everything.
(Thanks to all the people that contributed to this entry teaching me the wonders of the english cosswords. You’re more than you think 😉 )
Like this:
Like Loading...