包org.springframework.batch.item.excel。*不可用

时间:2016-02-18 18:54:05

标签: xml spring

我是Spring Batch的新手。我正在尝试使用PoiItemReader读取.xls文件。但是在我的jar中,包org.springframework.batch.item.excel。*不可用。

的pom.xml

enter image description here

<dependency>

        <groupId>org.springframework.batch</groupId>
        <artifactId>spring-batch-core</artifactId>
        <version>3.0.6.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.batch</groupId>
        <artifactId>spring-batch-infrastructure</artifactId>
        <version>3.0.6.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.batch</groupId>
        <artifactId>spring-batch-integration</artifactId>
        <version>3.0.6.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.integration</groupId>
        <artifactId>spring-integration-core</artifactId>
        <version>3.0.6.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.integration</groupId>
        <artifactId>spring-integration-mail</artifactId>
        <version>3.0.6.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.integration</groupId>
        <artifactId>spring-integration-stream</artifactId>
        <version>3.0.6.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.integration</groupId>
        <artifactId>spring-integration-file</artifactId>
        <version>3.0.6.RELEASE</version>
    </dependency>

    <dependency>
        <groupId>org.springframework.integration</groupId>
        <artifactId>spring-integration-test</artifactId>
        <version>3.0.6.RELEASE</version>
    </dependency>

3 个答案:

答案 0 :(得分:2)

您还需要excel的spring batch extention。你可以在github找到它:

https://github.com/spring-projects/spring-batch-extensions/tree/master/spring-batch-excel

答案 1 :(得分:0)

谢谢EveryOne。

我已经获取了excel-reader-extension项目的所有相关类,并创建了jar文件,并且可以在现有项目中轻松使用,而无需创建任何子Pom.xml

确保您的jar文件应包含源文件,否则Spring将在启动应用程序时通过classNotFound Exception。

~Abhishek Sahu

答案 2 :(得分:0)

您必须从此链接克隆spring batch excel项目

https://github.com/spring-projects/spring-batch-extensions/tree/master/spring-batch-excel

,然后将其导入到您的IDE中并运行mvn clean install命令,该命令将自动使其在您本地的maven存储库(即m2文件夹)中可用。