Monday, February 20, 2006

JarJar Links saves Naboo - and Java dependency packaging - again

One of the problems I faced at a client site recently was due to the success of open source software. What was the problem? Some software is so popular that everybody use it, but they use and depend on a particular version of that software. For example, everybody these days is using Apache Commons, Hibernate, etc. When you have to connect to multiple systems and each system has a dependency on a different version of the same third-party lib you can run into all sorts of problems depending on which version is picked up by the classloader (you Windows people remeber DLL Hell?).

I began writing a tool to modify Java bytecode that would rewrite package names of dependent libraries so that you could create a unique dependency (e.g. if your software has a package name com.x and depends on Apache commons, then rewrite the package name org.apache.commons to, but as often happens, I found a tool that already does this. JarJar Links (no, not that marketing tool from the Phantom Menance) has some Ant tasks that do a very good job of rewriting package names.

Long live the Java Dependency Empire!

No comments: