Avoiding missing-classpath lintian warnings with Maven based packages

Whilst I’ve been preparing the large dependency chain to support Jenkins for upload into Debian and Ubuntu I came across a new lintian warning:

libakuma-java: missing-classpath libjna-java

This is a new check that validates that the jar files associated with a debian -java package have a Class-Path entry set in the META-INF/MANIFEST.mf file.

This is used by wrapper scripts to dynamically set the classpath for Java applications at runtime based on the libraries that they use.

However, if you are packaging Maven based projects you don’t get this set for free (although that would be a great feature for maven-debian-helper).

Luckily the javahelper package has a CDBS class that can help out; simply add javahelper to the Build-Depends for your package then follow these steps:

1) debian/rules

Add the javahelper.mk class into the make file:

#!/usr/bin/make -f

include /usr/share/cdbs/1/rules/debhelper.mk
include /usr/share/cdbs/1/class/javahelper.mk
include /usr/share/cdbs/1/class/maven.mk

2) Add a .classpath file for the binary package

In my case this gets dropped into debian/libakuma-java.classpath

usr/share/java/akuma.jar /usr/share/java/jna.jar

Rebuild your package; the jar files should now have Class-Path entries and you should be lintian clean.



Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: