Required maven dependencies for Apache POI to work

前端 未结 10 951
长情又很酷
长情又很酷 2021-01-03 19:17

I want to use Apache POI library to parse excel files (old versions and newer versions of excel). So I was wondering what jars do i need to include from the Apache POI becau

相关标签:
10条回答
  • 2021-01-03 19:47

    There are multiple jars which are required for your APACHE POI to work with your application.

    List of JAR file:-

    1. poi-4.1.0
    2. poi-ooxml-4.1.0
    3. commons-collections4-4.3
    4. commons-compress-1.18
    5. xmlbeans-3.1.0
    6. poi-ooxml-schemas-3.9
    7. dom4j-1.6.1
    0 讨论(0)
  • 2021-01-03 19:49

    For an excel writer you might need the following:

                <dependency>
                  <groupId>org.apache.poi</groupId>
                  <artifactId>poi</artifactId>
                  <version>3.10-FINAL</version>
               </dependency>
    
    
            <dependency>
                 <groupId>org.apache.poi</groupId>
                <artifactId>poi-ooxml</artifactId>
                <version>${apache.poi.version}</version>
           </dependency>
    
    0 讨论(0)
  • 2021-01-03 19:54

    this is the list of maven artifact id for all poi component. in this link http://poi.apache.org/overview.html#components

    0 讨论(0)
  • 2021-01-03 19:58

    No, you don't have to include all of POI's dependencies. Maven's transitive dependency mechanism will take care of that. As noted you just have to express a dependency on the appropriate POI artifact. For example:

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

    Edit(UPDATE): I don't know about previous versions but to resolve imports to XSSFWorkbook and other classes in org.apache.poi package you need to add dependency for poi-ooxml too. The dependencies will be:

    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>4.1.2</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>4.1.2</version>
    </dependency>
    
    0 讨论(0)
  • 2021-01-03 20:00

    The following works for me:

    <!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.16</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.16</version>
        </dependency>
    
    0 讨论(0)
  • 2021-01-03 20:03
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.10-FINAL</version>
        </dependency>
    
    0 讨论(0)
提交回复
热议问题