Let me start by saying that I have seen a lot of questions regarding the error XSSFWorkbook cannot be resolved to a type
. However, I have looked into most of them, and the accepted answer seems to be to add the Maven dependency poi-ooxml. Indeed, this is supported by the information on the Apache POI official site.
However, this is still not working for me. All the answers that I have seen so far used quite older versions. I fear that the answer might be different for the current ones.
Another interesting thing is that I was using the jar manually before, and I didn't experience any issues. However, when trying to import it as a Maven dependency, org.apache.poi.xssf.usermodel.XSSFWorkbook
seems to be the only import that it's missing.
Ps: I've also tried to use poi-ooxml-full and poi-ooxml-schemas, but none of it worked.
pom
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>s6-night-shift</groupId>
<artifactId>s6-night-shift</artifactId>
<version>0.0.1-SNAPSHOT</version>
<build>
<sourceDirectory>src</sourceDirectory>
<resources>
<resource>
<directory>src</directory>
<excludes>
<exclude>**/*.java</exclude>
</excludes>
</resource>
</resources>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<release>15</release>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.sun.activation</groupId>
<artifactId>javax.activation</artifactId>
<version>1.2.0</version>
</dependency>
<dependency>
<groupId>com.j2html</groupId>
<artifactId>j2html</artifactId>
<version>1.5.0</version>
</dependency>
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
<version>1.5.0-b01</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>5.2.0</version>
<type>pom.sha512</type>
</dependency>
</dependencies>
</project>