在终端...中运行snapshot.jar文件后出现清单错误。我应该添加哪个清单?

时间:2019-06-10 09:12:28

标签: java apache-poi

我添加了依赖关系,但是我遇到了异常

dom4j poi poi-ooxml poi-ooxml-schemas xmlbean

这是我的代码

        File resourceFile = new File("chargeholdermapping.xlsx");   
        FileInputStream fs = new FileInputStream(resourceFile);
        XSSFWorkbook wb = new XSSFWorkbook(fs);
        XSSFSheet sheet = wb.getSheetAt(0);
        Row row;
        for (int i = 1; i <= sheet.getLastRowNum(); i++) {
            row = sheet.getRow(i);
            String originalValues = row.getCell(0).getStringCellValue();
            String showingValues = row.getCell(1).getStringCellValue();
            pstm = (PreparedStatement) conn.prepareStatement(sql);
            pstm.setString(1, originalValues);
            pstm.setString(2, showingValues);
            pstm.execute();
            System.out.println("Import rows " + i);
        }

1 个答案:

答案 0 :(得分:0)

添加依赖项 POM.xml

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


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