Search code examples
javaeclipsemavenopen-sourcedependencies

Bundling a non-open-source dependency with Maven


Suppose I have two Java projects in Maven / Eclipse:

  • An open source application hosted in GitHub
  • A small private library containing utility functions which is not open source (but which I do have the rights to modify, build, and redistribute in compiled form e.g. as a .jar file)

I'd like to make it possible for others to build, modify and run the application (and contribute back to the open source project if they like!), but this means that they will also need the library as a dependency.

I'd like to keep things simple, so that builds are easy both for myself and users of the application.

What's the most practical way to make this work?


Solution

  • Provide your own Maven repository on GitHub to distribute the closed source library which you are allowed to redistribute and reference it from your project (pom.xml).

    http://cemerick.com/2010/08/24/hosting-maven-repos-on-github gives a nice introduction on how to set up a repository on GitHub. You should be aware of the caveats of such a micro repository also mentioned in that post.