IDEA / Maven无法解析Apache POI类

时间:2017-05-24 19:27:49

标签: maven intellij-idea apache-poi

我正在尝试将Apache POI与此Groovy DSL“groovy-excel-builder”一起使用,同时在Windows 10上使用JDK 1.8.0_112-release-736-b21在IntelliJ IDEA 2017.1.3中工作。

我收到以下错误:
Error:(3, 1) Groovyc: unable to resolve class org.apache.poi.xssf.usermodel.XSSFRow

通过单击import语句的“usermodel”部分,我可以在IDEA中看到包和类:
import org.apache.poi.xssf.usermodel.XSSFRow import org.apache.poi.xssf.usermodel.XSSFCell

我有以下依赖

        <!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>3.16</version>
    </dependency>
    <dependency>
        <groupId>com.jameskleeh</groupId>
        <artifactId>excel-builder</artifactId>
        <version>0.4.0</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml-schemas -->
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml-schemas</artifactId>
        <version>3.16</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/org.apache.xmlbeans/xmlbeans -->
    <dependency>
        <groupId>org.apache.xmlbeans</groupId>
        <artifactId>xmlbeans</artifactId>
        <version>2.6.0</version>
    </dependency>

1 个答案:

答案 0 :(得分:2)

您需要添加以下依赖项:

<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
  <groupId>org.apache.poi</groupId>
  <artifactId>poi-ooxml</artifactId>
  <version>3.16</version>
 </dependency>