If you’re developing in Java and also using Maven you should be using a repository manager. You probably have one at work. But do have one for your hobby projects? As you probably know; proxying Maven repositories can be quite beneficial. It speeds up builds, as all dependencies only have to be downloaded from the remote repository once. And you will also have a nice place to store your own artifacts. Not everyone have a stock home server that can run such a repository manager, including myself. However I do have a Synology 1513+ NAS. This post shows how you can run Apache Archiva on this device and it’s sibilings in the 1×13+ series.
There are basically two ways of running Archiva; It can be a standalone application, or it can be a executing in a servlet container such as Apache Tomcat. The latter already comes in a handy package for Synology. In either case Java must be installed.
I started out by installing the Apache Tomcat package and continued by installing the Archiva WAR file into Tomcat. When I attempted to start Archiva I was rewarded with a wide range of error messages. A new one every time I tried something. I’m no Tomcat guru so I gave up and decided to run the standalone version of Archiva.
This method requires that a wrapper application is built for the CPU that the the 1513+ has (Intel Atom D2700). I suspected that one of the ones shipping with Archiva would work, but decided to cross compile the wrapper using spksrc. With a bit of tweaking the standard distribution actually worked. However it would be a lot better if Archiva could be distributed as a Synology DSM Package (*.spk). This way I could just install the file using the DSM package manager and no tweaking would be required.
So I ended up with a bash script that downloads the Archiva distribution from Apache, tweaks it some and packages it for the Synology NAS. The source code is at GitHub and also the package for download, Archiva-x64-2.0.1-47-bin.spk. This can easily be manually installed using the package manager. Feel free to try it out. It works nicely on my host, but there may be some bugs.
After installing Archiva you must tell your local Maven to use the new proxy. Simply add the following section to ~/.m2/settings.xml. Remember to replace 192.168.1.10 with the name or IP-address of your Synology DS.
You should probably set up the firewall so that one cannot access the server from the outside of your LAN. There are a lot of prying bots out there.