May 22, 2014

Downloading a JAR's Dependencies

Ever find a jar that has it’s dependencies declared in a pom, but you don’t use maven?

I do all the time… because I don’t ever use maven!

So, here’s the deal:

  1. create a pom that looks something like this:

     <?xml version="1.0"?>
     <project xmlns="" xmlns:xsi="" xsi:schemaLocation="">
         <name>Simple POM to download some dependencies</name>

    The example above downloads the dependencies for Netflix’s rxjava-core (version 0.18.3) jar.

    Note: Figure out your dependeny’s actual groupId, artifactId, and version numbers are by checking out maven central

  2. execute this at your terminal:

     mvn -f example-pom.xml dependency:copy-dependencies

    Need maven? brew install maven, if you’re on OS X.

  3. wait while maven downloads the Internet.

  4. bask in the glory of your new pile of jars. (located at target/dependency)

For me, I was really wanting to download the dependencies for retrofit. I’ve dropped the above and an example for retrofit into a gist for your viewing pleasure: