<< Sneaky Sound System | Home | Inventing on Principle >>

OneJar To Rule them all

I've been working on a command line java app at work which is part of a cron based batch process which updates some data between systems. Using maven, spring and mybatis means that I had the framework up and running within a couple of hours to pull data from backend DBs and output a file with some data. 

Then I ran into a problem when I wanted to package it all up as a jar file which could be run directly from the command line via cron. The tricky part is in packaging up all the jars that are included as part of spring, mybatis, etc. and be able to run them in a way that they are all available on the classpath without munging each other.

Well, OneJar to the rescue! Everything packaged up all nice and neat. Just run 'mvn package' to get the jar and then use the usual 'java -jar app.jar' to run it. Works like a charm. Even has a Maven plugin to minimize the work needed to get it up and running.


Add a comment Send a TrackBack