Search code examples
javamavenapache-poixlsx

Apache POI to load xlsx - package does not exists and cannot find symbol with maven


I'm trying to use apache POI lib, to load xlsx files in Java program.

As per doc here https://poi.apache.org/components/ I started with the following components (I'm using maven)

    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>5.0.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>5.0.0</version>
    </dependency>

    

but I got some issues

java: package org.apache.poi.ss.usermodel does not exist

java: cannot find symbol
symbol:   class Workbook

java: cannot find symbol
symbol:   class Sheet

java: cannot find symbol
symbol:   class Row

following some other stackoverflow suggestion I added other dependencies, eventually tried all of them but still not working

    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>5.0.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>5.0.0</version>
    </dependency>

    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-scratchpad</artifactId>
        <version>5.0.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml-full</artifactId>
        <version>5.0.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml-lite</artifactId>
        <version>5.0.0</version>
    </dependency>

still not working

I'm using open JDK 15, tried also with 11, no changes

any suggestion?


Solution

  • It came out to be an IntelliJ issue: mvn was compiling correctly but running via intellij was not neither a rebuild solved the issue

    the only wayout was to:

    1. close the project
    2. cancel .idea folder
    3. re-import the project