1. java
  2. packaging

Building Debian Packages in Java

A truely platform independent way to build Debian packages without the native tools.

Using native packaging formats to install Java applications leverages existing and well-tested tools and infrastructure for software deployment. But one of the perks of Java has always been the cross-platform build. Using the standard native tools to create these native packages breaks the promise of a cross-platform Java build.

With the jdeb project there is a way to create native Debian packages directly from your ant or maven build. It lets you create

Debian packages without using the native tools.

So whether you build on Linux, Windows or macOS you get a valid package that is ready to be deployed.

The only requirement is to add a control file that provides metadata about the package. It declares things like name, version and most importantly dependencies.

Package: [[name]]
Version: [[version]]
Section: misc
Priority: low
Architecture: all
Description: [[description]]
Maintainer: Torsten Curdt <tcurdt@foo.org>
Depends: default-jre | java6-runtime

The integration is easy with ant. Just specify the paths and provide the data that should get included in the package.

  verbose="true" >
  <data type="file"
    src="${build.dir}/jar/${ant.project.name}-${version}.jar" >
    <mapper type="perm" prefix="/usr/share/jdeb/lib"/>

With maven jdeb attaches to the package phase. A build now creates the jar then builds the package and attaches it as a secondary artifact.


For more information check out the documentation and the examples or join the community for a chat on gitter.

Or subscribe to the RSS feed