1

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.

Smashh
  • 11
  • 3
  • 1
    Please update the question with the complete error message. You can find quite a few questions on SO, which reads module not found as a problem as well. – Naman May 26 '19 at 05:41
  • https://stackoverflow.com/questions/50353001/java-9-automatic-modules-not-found Maybe you're running into a similar issue? – abelito May 26 '19 at 12:49
  • Updated the compete error. – Smashh May 27 '19 at 18:23

0 Answers0