Converting maven/Gradle dependencies into debian dependencies


(franck) #1

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 ?

Thank you


(Yuriy Kryshchuk) #2

Here is the sample message from the package manager when we try to install two components providing the same JAR file:

dpkg -i cd-evoc-8.1.0-20121231.105329-1.deb (Reading database … 44924 files and directories currently installed.) Unpacking cd-evoc (from cd-evoc-8.1.0-20121231.105329-1.deb) … dpkg: error processing cd-evoc-8.1.0-20121231.105329-1.deb (–install):

trying to overwrite ‘/usr/share/java/spring-aop-3.1.1.RELEASE.jar’, which is also in package cd-me 0:8.1.0-20121231.104516 dpkg-deb: subprocess paste killed by signal (Broken pipe)

Removing any system startup links for /etc/init.d/cd-evoc … Errors were encountered while processing:

cd-evoc-8.1.0-20121231.105329-1.deb