Skip to content
Advertisement

How to add dependencies to DEB created by JPackage?

I have a java application that I package with jpackage and receive a debian package.

At runtime the application relies on another piece of software being installed, and it comes from another debian package. I want the Ubuntu package manager to automatically resolve this dependency. But that means I have to declare the dependency somehow in my debian package.

What do I need to do to jpackage so that it creates the debian archive with my additional dependency?

Advertisement

Answer

So I resolved it by overriding jpackage resources, as mentioned in https://docs.oracle.com/en/java/javase/15/jpackage/override-jpackage-resources.html#GUID-405708DC-0243-49FC-84D9-B2A7F0A011A9.

DEB packages contain a control file which contains the metadata required for package management. Inside this file the dependencies to other files are declared. Create a directory containing your desired control file, then specify –resource-dir and the path to your directory on the jpackage command line. Rather than generating it’s own control file jpackage will copy the given resource into the DEB.

Hints:

  • To get a first example of this control file, just open the DEB using some archive manager and extract the control file.
  • To be still flexible for version numbers or other stuff in that file it is advisable to generate it using some templating mechanism of your build system.
User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement