I'm using Apache POI 4.1.0 library to read/write Microsoft Word document. I'm using JDK 11 (java modules in play here) with module definition. My project build fails to compile with "module not found: poi.ooxml". How do I get this to work?
Apache POI FAQ https://poi.apache.org/help/faq.html#faq-N102B0 says Apache POI version 4.1.0 supports Java 11 modules, but something is off and my project fails to compile.
Java class using Apache POI
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
import org.apache.poi.xwpf.usermodel.XWPFDocument;
build.gradle
dependencies {
compile group: 'org.apache.poi', name: 'poi', version: '4.1.0'
compile group: 'org.apache.poi', name: 'poi-ooxml', version: '4.1.0'
}
module-info.java
module x.server {
exports com.sample.x.server;
requires poi.ooxml;
}
I've tried using
module x.server {
exports com.sample.x.server;
requires org.apache.poi.ooxml;
}
I expect it to build successfully, but it fails to compile with :
Task :server:compileJava FAILED ./server/src/main/java/module-info.java:3: error: module not found: poi.ooxml requires poi.ooxml; ^ 1 error
FAILURE: Build failed with an exception.