gpt4 book ai didi

java - Apache 兴趣点: "Cannot resolve symbol"

转载 作者:行者123 更新时间:2023-11-30 06:46:08 35 4
gpt4 key购买 nike

我想使用 Apache POI 在 Java 中读写 Excel 文件。我正在使用 Maven 作为依赖项,但是在导入时出现错误:例如 Cannot resolve symbol usermodel

这些是我的进口:

import org.apache.poi.ss.usermodel.Cell;
import org.apache.poi.ss.usermodel.Row;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;

这是我的 POM:

<?xml version="1.0" encoding="UTF-8"?>
<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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>groupId</groupId>
<artifactId>Boekhouding</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-3.17</artifactId>
<version>3.10-FINAL</version>
<systemPath>${basedir}\src\lib\poi-3.17.jar</systemPath>
</dependency>


<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${apache.poi.version}</version>
<systemPath>${basedir}\src\lib\poi-ooxml-3.17.jar</systemPath>
</dependency>
</dependencies>
</project>

最佳答案

改变你的依赖关系。这样更适合解决。

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

关于java - Apache 兴趣点: "Cannot resolve symbol",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47971426/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com