How to package software built with Maven in Debian


The answer is maven-debian-helper. This tool must always be added to Build-Depends in debian/control when you want to package a pure Maven-based project.

The most important Debian specific packaging files are:, maven.rules, maven.ignoreRules and the debian/$PACKAGE.poms file. is the file to disable tests or override specific values in your pom.xml file. maven.rules is able to override Maven coordinates in pom.xml and point to Debian's local /usr/share/maven-repo. Downloading build-dependencies from the internet at build-time is forbidden. This is enforced by maven-debian-helper. You must package all build-dependencies for Debian and then you can use your system libraries to build the package.

maven.ignoreRules helps to ignore certain artifacts, either because they are not needed (test dependencies) or because they are not available in Debian yet.

Sometimes you only need one Maven submodule. The poms file can ignore certain submodules, install artifacts also into /usr/share/java (which is useful for Ant projects), rename artifacts or ignore parent pom files.

More information and how they function are available at See also the Maven examples