Is there a way to add maven dependencies while using the maven-jlink-plugin?

This has not much to do with the plugin I believe. Module joda.time in your case seems to be an automatic module.

The jlink tool does not support linking of automatic modules because they can rely on the arbitrary content of the classpath, which goes against the idea of a self-contained Java runtime.

So there are two ways to fix this probably :-

  • (you don't own the jar) Temporarily go ahead create a module-info.java[you could use jdeps tool for it] and update the jar[using jar tool] with the corresponding compiled class as in projects under Java 9.

  • (you own the dependency) Permanently migrate the jar to Java 9 itself, where it would consist of the module-info.class by itself after being compiled and packaged.


You could use the ModiTect Maven plug-in to add a module descriptor to the JAR and create a modular runtime image with that module.

Disclaimer: I'm the author of ModiTect.