Debian packages with Maven

Last week, I accidentally came across the debian-maven-plugin (by Wouter Bosma) on sourceforge.net:

https://sourceforge.net/projects/debian-maven/

Since most of my projects are Maven based, I thought this would be great to add to the build process. At the moment, I usually only generate zip files with all the necessary libraries, sources, documentation and start scripts. Most of the time this approach is sufficient, but when building docker containers, it would be nicer to simply install a .deb package.

Unfortunately, the project had not seen any development for quite some time, with the last release on Maven Central dating back to October 2013.

The current state of the plugin was not quite sufficient (I needed artifact exclusion based on regular expressions rather than explicitly listing all of them), so I decided to fork the project and add the required functionality:

https://github.com/fracpete/debian-maven-plugin

A week and several releases later, it now offers the additional functionality:

  • can handle paths with spaces
  • exclusion of artifacts via regular expressions
  • default library path is now standard /usr/lib/PKGNAME instead of /usr/share/lib/PKGNAME
  • library path can be specified via parameter now
  • documentation output can be specified via parameter now
  • man page directory (if applicable) can be specified via parameter now
  • creation of include files (.inc) can be turned off now
  • generation of symlinks to jars can be turned off now
  • fixing of file permissions (eg of scripts) is now handled by the plugin itself rather than relying on the maven-antrun-plugin in conjunction with the chmod task.
  • copying of resources is now handled by the plugin itself rather than relying on the copy-resources goal of maven-resources-plugin
  • works with multi-module projects now as well, allowing you to turn off Debian package generation off for the top-level module

Documentation is also hosted on Github now:

https://fracpete.github.io/debian-maven-plugin/

Thanks to the heavy lifting of Wouter in developing the original version of this plugin, I could turn it into a Maven plugin for a lot of my projects!