I'm having an issue that has been driving me crazy for days. I'm relatively new to the Java modular system but was managing to declare my dependencies correctly until I started to use poi.
Here is my build.gradle snippet (gradle v 6.4):
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.slf4j:log4j-over-slf4j:1.7.30'
implementation 'org.springframework.boot:spring-boot-starter-data-jpa'
implementation 'commons-net:commons-net:3.6'
implementation 'com.google.guava:guava:28.1-jre'
implementation 'org.apache.poi:poi:4.1.2'
implementation 'org.apache.poi:poi-ooxml:4.1.2'
}
Here are the poi jars correctly located in my gradle cache:
~/.gradle/caches/modules-2/files-2.1/org.apache.poi$ tree
.
├── poi
│ └── 4.1.2
│ ├── 964bf41cf68bce08e4ef6b2279b559fdf8d454f4
│ │ └── poi-4.1.2.jar
│ ├── 9ce4c76815903772b25324d8419df2d3fe227f4d
│ │ └── poi-4.1.2.pom
│ └── ac5af3832ebaef94562a39591a000338bbae0e4b
│ └── poi-4.1.2-sources.jar
├── poi-ooxml
│ └── 4.1.2
│ ├── 712cc02d5bbe729d2485a1579f3d8dfc47e25b51
│ │ └── poi-ooxml-4.1.2-sources.jar
│ ├── 87d9a22aa9a7dd26e80c360e709f7ee02e32ab3b
│ │ └── poi-ooxml-4.1.2.jar
│ └── ccbcde71e4f0fdfa80e1007dd1babfc9828c629e
│ └── poi-ooxml-4.1.2.pom
Here is my module-info.java:
module template {
requires spring.core;
requires poi;
requires poi.ooxml;
}
Here is the error I get on running gradle clean build:
error: module not found: poi
requires poi;
^
Things I have tried:
- Deleting my gradle cache and doing a complete --refresh-dependencies build
- Finding all the poi and poi-ooxml subdependencies and adding to the build.gradle
- Using "api" instead of "implementation" for poi and poi-ooxml in the build.gradle
I am at my wits end on this -working on my day off! - and could really appreciate some input.