Jpkg is a Java library and Ant task for creating operating system packages, currently only Debian packages. The Ant task and library are heavily unit tested and provide as strict an implementation of the Debian specification as possible. Not all features of the .deb format are supported, but enough are implemented for the packages to be useful outside of the context of the Debian distribution itself.
Jpkg was designed to package production Java software and ship it via APT to FreeBSD servers. A build server compiled the code, copied the code into a destroot, invoked Jpkg to package the code, and then used rsync to mirror the generated APT repositories throughout the infrastructure. By leveraging an existing packaging system we were able to easily support isolated distributions, dependencies, versioning, and rollbacks, none of which the previous Ruby/rsync deployment mechanism provided.
In the process of writing Jpkg, I ended up writing a library called Antidote, which is included with Jpkg. This library contains useful features inspired by implementing a number of Ant tasks over the course of two years, mainly to deal with mutable state and Ant reference handling. I also wanted a way to collect data validation violations and then present all of those issues to the user at once, much like a compiler, along with clear suggestions and/or reasons why the user supplied data was invalid.
I was working for Three Rings Design when developing Jpkg and they kindly allowed me to open sourcing the results.
An example declaration of a package in a build.xml file is included below.
<dpkg output="dist/dpkg_out" prefix="/usr/local/" distribution="unstable">
<package destroot="dist/destroot">
<info>
<name>packagename</name>
<version>1.2</version>
<arch>i386</arch>
<description>Package description</description>
<maintainer>
<name>Package Maintainer</name>
<email>maintainer@package.com</email>
</maintainer>
<priority>optional</priority>
<section>misc</section>
</info>
<permissions>
<permission user="username" group="groupname" mode="755" recursive="true">
<path>bin/</path>
</permission>
</permissions>
<dependencies>
<require package="packagename">
<equalTo>1.4</equalTo>
</require>
<conflict package="conflictswith"/>
<replacement package="replacethis"/>
<alternatives>
<require package="option1">
<equalOrLesserThan>12.1a</equalOrLesserThan>
</require>
<require package="option2"/>
</alternatives>
</dependencies>
<scripts>
<postinst source="script_source/postinst.sh"/>
<prerm command="echo test prerm message"/>
</scripts>
</package>
</dpkg>