I have to create Debian packages for all applications in my current project. These are standalone applications that are launched like “java -jar …”. Each project provides its own JAR artifact which depends on a couple of other project artifacts and there are lots of 3rd party dependencies (both compile and runtime).
Right now I can build a debian package that includes all needed JARs (dependencies with transitives, some resource files, scripts etc).
I also specify the JRE Debian dependency in a control file configuration for my packages, so that Java gets installed as well.
I create deb packages with codehaus unix-maven-plugin.
The JARs are installed to /usr/share/java, scripts to /usr/bin etc.
As long as I install exactly one package on a server it is fine: installation and runtime succeeds. But if there is already a software installed that provides one of the JARs that my package contains (for example slf4j-api-1.5.10.jar) I have problems installing the package. The APT package manager complains about file conflicts. That happens also when I try to install two of my applications on the same server which obviously provide a set of duplicate jar files.
The solution for my problem would be not to include the JAR files that are made available by other debian packages, instead declaring those packages in the “Depends” section of control file. Of course not every JAR from maven repository have a corresponding debian package available, but for those missing artifacts I can create these debian packages myself.
Are there any available ways with Gradle to convert the maven/Gradle dependencies into a list of debian dependencies (“Depends” section in control file), so that my delivery does not redistribute those JAR files that are available as external debian packages in the OS distribution ?
Is there any online service/plugin that I can use with Gradle to find the debian packages that might discover whether the the JARs I need for my application are available in the OS repo ?