No build system
This is very similar to the Java 101 examples. Instead of using javac manually, the Javahelper tools, especially jh_build, become very useful.
Javahelper is documented in the javahelper package in /usr/share/doc/javahelper/tutorial.txt.gz, also replicated here.
Simple package without a proper build system. Javahelper and its jh_build tool are the ideal helpers to compile the source code and create a jar file.
javabuild / jh_build
The source code resides in a single directory. You can either use a debian/javabuild file or you can call jh_build in debian/rules directly.
Name of the jar file directory with source code
The syntax is very simple. You can build multiple jar files by specifying one name and source directory per line. In this case there is only one org directory.
%: dh $@ --with javahelper --with jh_maven_repo_helper
In order to make use of javahelper you have to build-depend on it in debian/control and pass --with javahelper to dh sequencer.
jlibs / jh_installlibs
To install the resulting jar into the canonical directory for shared Java libraries (/usr/share/java), you can use either a debian/jlibs file or jh_installlibs in debian/rules.
The jlibs file installs one jar file per line into /usr/share/java, by default unversioned and versioned.
The jh_maven_repo_helper tool is included in Javahelper and intended to be used to install Maven artifacts into /usr/share/maven-repo. To make it work a *.poms file must be present in the debian directory. maven-repo-helper is a drop-in replacement. See the maven-repo-spec and the tutorials for maven-debian-helper to learn more about Maven packaging.
The osgi-core package is very similar to intellij-annotations.
override_jh_build: jh_build --javacopts='-encoding UTF-8' --javadoc-opts='-encoding UTF-8'
In this case jh_build and its options --javacopts and --javadoc-opts are called to overwrite the default encoding. It also uses --with jh_maven_repo_helper to install Maven artifacts and a jlibs file to install the resulting jar.