How do I write module-info requires statement from GAV coordinates of a non-modular dependency?

Viewed 150

I am converting a legacy java app to a modular one. It is a Gradle project, and the dependencies look like this:

dependencies {
    implementation 'org.jopendocument:jOpenDocument:1.3'
    implementation 'xom:xom:1.3.2'
}

In the App class, my imports are:

import nu.xom.Document;
import nu.xom.Element;
import nu.xom.Serializer;
import org.jopendocument.dom.spreadsheet.MutableCell;
import org.jopendocument.dom.spreadsheet.Sheet;
import org.jopendocument.dom.spreadsheet.SpreadSheet;

I want to create a module-info.java file. But when I do, my app won't compile because the requires directives are wrong in the module-info file.

module weapongeneration4dusty.main {
    requires xom;
    requires jOpenDocument;
    exports com.hymerfania.rptools.maptool.meta.tablegeneration;
}

The module names xom and jOpenDocument are insufficient. But I don't know what they should be for these dependencies, nor how to reconfigure Gradle; if that's what I need to do.

When I omit either requires statement, the corresponding imports fail to resolve. I have not looked in the JAR files. But I don't think either artifact is modular.

I'm using Gradle 5.6.2 and I'm targeting Java 11.

0 Answers
Related