/ programming

Always publish your libraries to maven repositories

Maven is a great tool. I could spend a lot of time and effort telling you why, but if you use maven or have moved on to gradle or something similar, you already know why. That is not the point of this post. The point of this post is to get you, the open source software developer, to embrace maven the way it should be embraced.

One of the really great things about maven is that it, combined with a good version control system, such as git, allows you to work on your projects most anywhere with little to no effort. This gets even better when you combine it with something like docker, which allows you to create developer environments anywhere with little to no effort. Have a few hours to kill at a friends house or the library? Check out your project and work on it. Need to stay home from work to take care of your sick kids? Check out your project and work on it. Attending a dull meeting or conference? Check out your project and work on it.

Article continues after ad

Now in theory this works great. Unfortunately it's only mostly in theory. We live in a great time to be an open source dev. 99% of the time you can find libraries for anything you need thanks to github and friends. Unfortunately most of those libraries aren't available in a maven repository. You have to clone the project, and install it locally. Which sucks. It makes things hard. And it makes the scenario I described above a pipe dream. Any time you use one of the many great libraries out there, you end up with a project that cannot simply be checked out and worked on. You have to install all sorts of dependencies locally. The result is either a long check list of things that need to be cloned and installed before starting work, or the need to spend a lot of time creating scripts for bootstrapping your environment. This is unnecessary.

Why not simply run your own maven repository you might ask? I do, and I tend to share anything a put in there to the general public as well, but I shouldn't have to. And neither should anybody else. A private maven repository is a viable work around (because that is really what it is in my mind) for big companies and geeks like me. If you have the means and knowledge to do it. You need the dev-ops knowledge to do it, and you need the means to pay for virtual hosting to run it, since running a local maven repository doesn't add any benefits over simply using your local maven cache, you still have to install everything on each and every machine, and the whole point is to avoid that.

There is a very simple solution to this, but it involves all of the small time open source devs out there spending a tiny effort to make things easier for everybody. All you have to do is publish your libraries to a publicly available maven repository. Most of the big guys do it already. But even a lot of the big guys don't, which is a huge shame. The big guys aren't the people I want to reach here though, they can rest assured that their laziness makes me annoyed and I will voice my protests whenever I can. The guys I want to reach are you and I. The small guys. Publishing your tiny library on github. You rock. But you could rock even harder.

I get why you don't do it. You just want to get your software out there, and really don't care who uses it. I really get that. I'm the same. You might even think providing a maven repository is a lot of effort or will cost you something. It isn't, and it won't. You might think you need to be a dev-op and run your own nexus server. You don't. You can publish your project to the Sonatype Central Repository with very little effort and no cost.

By spending a tiny once off effort, you will be saving all of us lot's of time and effort, and we will thank you for it. And if we all do it, we will all benefit as well. And don't think your library is to small or not important enough to do it. If you put it on github, somebody will use it and in my honest opinion, that all it takes. If your project is on github it is important enough that it should be in a repository.

So please, spend the extra hour of time to help save hours and hours of time for us all.