[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

packaging java applications: questions from a newbie



Hi,

Context
=======

There's a Java application I've been working on during the last few years [1], and I'd like to package it. (It also uses two dependencies [2][3] which aren't available in a debian package, so I should also package them).

I'm new to Debian packaging, so I've spent the last few days reading documentation and experimenting. Now I'm nearly able to package my application and its dependencies, but there are some things that I don't understand yet.

To complete the overview, I should add that, my application builds with Maven. One of its dependency builds with Gradle. And the other with Ant.

In short
========
In short, my main questions are:

1- Is it ok to package each of those 3 projects with jh_helper?
2- My application should be usable as an executable, but it would also make sense to provide this jar as a library. Is there a standard way to handle it?
3- How can I force compilation with java7, using java helper?
4- What is the standard way to avoid shipping unit tests in package built with java helper?

In details
==========

With a bit more details, my questions are:

1- I've seen that there are several packaging tools for Java. In particular I've tried maven helper and java helper; and I've seen there's also a ad hoc tool for projects built with ant.
Since I want to build 3 projects which each use a different build system, it seems to me it would be easier to use jh_helper for each (and to let jh_build take care of their compilations).
Is it ok to do it, or are there any drawbacks?

2- As far as I've understood, if my jar is supposed to be used as a library, it should be installed in /usr/share/java. But when I create an application package with jh_makepkg, my jar is installed in /usr/share/<my-application>/<my-application>.jar
I can think of a workaround: create a library package, and create another package with an executable script that would launch this jar.
Is there a better way to handle this case?

3- With jh_build, I can force compilation with java7 (with `jh_build -o'-source 1.7').
However, I don't understand how I can pass this option when I launch the "debuild" command. So it ends up calling jh_build without this option, and the build fails.
I've seen I can specify to jh_makepkg that I want to build with opendjdk 7. As far as I understand, it sets JAVA_HOME accordingly. However, when jh_build is called without arguments, it then calls javac with flag '-source 1.5' (so my build fails).
How can I ensure javac will try to compile as java 7?

4- By default, jh_build will compile each java file it finds. So it ends up compiling tests (which bloats the jar I get in my .deb; and which adds an unneeded dependency on junit).
A workaround would be to remove each test files from the upstream tarball. Is it an acceptable way to do it, or is there a more standard way?

Many thanks for your replies!

Regards,
Guillaume

[1]: https://github.com/gturri/dokujclient
[2]: https://github.com/timroes/axmlrpc
[3]: http://www.martiansoftware.com/jsap/

Reply to: