This page is subject to change during the next weeks. Some of the information presented here are outdated and no longer valid. If you have questions regarding packaging Java software for Debian, please ask your questions on the mailing list email@example.com
In addition to the normal debhelper packaging tools there are some additional tools specifically for dealing with Java packages which are distributed in the javahelper package. These tools are integrated with both CDBS and DH7, but the recommended sequencer, and the one which be referred to throught this documentation, is DH7.
Use of javahelper is not actually required, however implementing the required policy elements without javahelper is quite difficult, so it is assumed that you will be using javahelper. Java policy is documented here, you should be familiar with what it says, even if most of the work is done for you by javahelper.
javahelper is documented in the javahelper package in /usr/share/doc/javahelper/tutorial.txt.gz, also replicated here. If you wish to use javahelper without using DH7 you will definitely need to read those docs, if you want to know all the things that javahelper can do for you, you probably also want to read the tutorial.
In addition to the tutorial, a talk was given at DebConf10 covering the use of javahelper. This is probably the best way to start understanding and using javahelper. The talk is available as:
The idea behind javahelper is that most Java packages should be trivial. The integration with DH7 means that you shouldn't need anything in debian/rules, just a few files under the debian directory. To demonstrate this there are a selection of sample demo packages available showing a complete debian/ directory for a few simple types of package.
Alternatively you might want to look at one of the good examples of up to date packages.
Using javahelper and DH7 ideally your rules file will look like this:
JAVA_HOME=/usr/lib/jvm/default-java %: dh $@ --with javahelper
All of the work is done by javahelper working from other files under debian/.
There are a few build systems in use by Java programs.
If your package uses Ant then DH7 should automatically detect the build.xml and call things appropriately.
Use maven-debian-helper for standard Maven projects, use maven-repo-helper and maven-ant-helper to fallback the build to Ant - usefull mostly for building a library which is part of the Build-Depends of Maven itself.
There is no helper currently. You can follow the example of bintray-client-java or from the list of packages using gradle as mentioned here.
jh_build is a very simple build system provided by javahelper for packages which don't come with an upstream build system or come with a broken one. It's described in the examples and the javahelper documentation referred to above.
Other build systems
If you have a different build system, or need to do something special with one of the build systems above, then you will need to add an override_dh_auto_build target to your debian/rules which will do whatever is necessary.
Things you need to do
There are a few things you do need to do in your package which javahelper can't do for you.
(This information will be added post-Squeeze)