Java DependencyDownloader : Resolve and download dependencies without Maven
Often times when I'm prototyping something in Java I find that I need a library that has dependencies on other libraries, which have dependencies on other libraries, etc... The generally accepted solution to this dependency nightmare is to use something like Maven, Ivy or Gradle to handle dependency management. These tools know how to talk to maven repositories which contain virtually any library you need.
While I'm sure those tools work fine for those who employ them, most of the time when I'm prototyping I want to do so in as lean a fashion as possible. I'd rather not have to spend the time to download, install and configure a tool when I will only be making use of a small portion of its functionality. I'm a fan of minimalism and reducing dependencies, which can be difficult when it seems like working in Java requires you to pick an IDE, Build tool and Dependency manager of which you can combine into many permutations. While this lends a lot of power and flexibility to the Java ecosystem, it also adds complexity which (in my opinion) many people are too willing to take at face value.
So, what I've done here is create a simple tool which does 80% of what I would use a build/dependency management tool to do: Resolve and download dependencies. I've published the source to GitHub [read on for details]
References
- Apache Maven [maven.apache.org]
- Apache Ivy [ant.apache.org]
- Gradle [gradle.org]
Requirements
This tool was developed and tested using Java 8 SE
Usage
To get a feel for the available options, run java -jar dependencydownloader.jar (no additional arguments)
The syntax is fairly straight forward:
java -jar dependencydownloader.jar <path_to_pom> <path_to_local_download_dir> CENTRAL|REPO1|<URL_to_repo> <true|false to enable or disable debug mode>
<path_to_pom> This is the path either http or local file system to get to the .pom file of the dependency you want to resolve
<path_to_local_download_dir> This is where you want to download the dependencies on your local machine
CENTRAL|REPO1|<URL_to_repo> This lets you choose which maven repo to download from. It defaults to Central and you can specify you're own URL if you'd like
CENTRAL = http://central.maven.org/maven2/
REPO1 = http://repo1.maven.org/maven2/
<true|false to enable or disable debug mode> This is fairly straight forward: If you'd like to see more details while the tool operates, pass in true. Otherwise it defaults to false to not muddy up the screen as much
Repository / Download
You can find the Git repository here: BoredWookie/tools
You can find a direct download link to dependencydownloader.jar here
Notes
This is very much an 'alpha' quality tool. I've only coded enough happy-path to help me shave off a lot of time that comes along with manually downloading dependencies.
You will find bugs, you will find problems. When you do, drop me a line here or open an Issue in GitHub [link at bottom]