Creating a Java application that downloads its own dependencies

I'm interested in how to distribute a Java application that has a lot of dependencies (specified in a pom.xml in Maven).

Obviously it would be possible to just package everything in one big .jar file. However that seems wasteful, since an update of the application would require sending a new copy of all the dependencies as well.

So I'm looking for a way of distributing the app that does the following:

  • Only includes the core application in the main .jar file
  • Downloads dependencies as needed when the .jar file is run
  • Keeps copies of the dependencies locally, so that if an application update is distributed the dependencies don't need to be downloaded again

What's the best way of achieving this?

Answers


you can distribute your file using the web start technology (aka distribute a jnlp file). i believe this will handle most of this functionality for you, including updatability.


Can you just use Maven, with something like described at Maven Run Project ?

This is how I have some of my own applications setup within my own network. I've never needed to worry about messing with the classpaths or downloading / providing dependencies for programs setup like this for a long time. This approach also meets all of your criteria.


Need Your Help

Required field in model

java google-app-engine objectify

Before I was using Python NDB API and there was required attribute which I can set on properties. I can't find anything similar in Objectify documentation. How to do that with Objectify?

Place Polyline on top of everything

c# windows-phone-7 graph plot polyline

I'm working on my own plotting library, but i've run into a problem. I have the following code to put my polyline on the windowsphone page:

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.