Repackaging Conflicting Jars With JarJar

I wanted to extend somewhat older application adding scripting capabilities using Groovy. Unfortunately, it crashed at the very start… the reason was application already has a bunch of libraries where some reference outdated version of the Asm (org.objectweb.asm) package, while Groovy used much fresher version.

My first though was to try updating Asm or some other packages but that lead to the whole new set of issues. Apparently, some of the libraries changed the API. Opening a can of worms and making considerable changes in a stable product was out of question.

So, after a bit of thinking, I thought it may be worth to lookup for some jar re-packaging tool. (Basically, what was needed is to use some Java bytecode manipulation tool that can rename conflicting package names to something else, also renaming all references to it, of source.) I used obfuscators before and I’m sure this could be done with ProGuard, but hoped there’s something easier to setup. Google to rescue… I’ve found a wonderful tool JarJar in few minutes and in 5 had by Groovy jar working without any conflicts.

I made a separate Ant project for running JarJar. Here it is in case someone needs it:

< ?xml version="1.0"?>