Required maven dependencies for Apache POI to work

2020-07-01 09:16发布

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 because in following link:

http://mvnrepository.com/artifact/org.apache.poi

I found lots of jars to be included, do I need to include them all?

If so, what is the latest stable version to be included, and does it work with Microsoft's Office 2010?

10条回答
放荡不羁爱自由
2楼-- · 2020-07-01 09:43

I used the below dependency. If you are using Selenium then it's good to use all of them as below. Else you will see some errors and then do the reserch and add some more dependencies.

<dependency>
                 <groupId>org.apache.poi</groupId>
                 <artifactId>poi</artifactId>
                 <version>3.9</version>
          </dependency>
          <dependency>
                 <groupId>org.apache.poi</groupId>
                 <artifactId>poi-ooxml</artifactId>
                 <version>3.9</version>
          </dependency>
          <dependency>
                 <groupId>org.apache.poi</groupId>
                 <artifactId>poi-ooxml-schemas</artifactId>
                 <version>3.9</version>
          </dependency>
          <dependency>
                 <groupId>org.apache.poi</groupId>
                 <artifactId>poi-scratchpad</artifactId>
                 <version>3.9</version>
          </dependency>
          <dependency>
                 <groupId>org.apache.poi</groupId>
                 <artifactId>ooxml-schemas</artifactId>
                 <version>1.1</version>
          </dependency>

          <dependency>
                 <groupId>org.apache.poi</groupId>
                 <artifactId>openxml4j</artifactId>
                 <version>1.0-beta</version>
          </dependency>
查看更多
贪生不怕死
3楼-- · 2020-07-01 09:45
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>3.10-FINAL</version>
    </dependency>
查看更多
Anthone
4楼-- · 2020-07-01 09:49

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
查看更多
太酷不给撩
5楼-- · 2020-07-01 09:51

ooxml for dealing the .xlsx files and the ooxml refers to the xml, hence we will be needed to refer the below three dependedncies in the pom.xml for the

<dependency>
   <groupId>org.apache.poi</groupId>
   <artifactId>poi</artifactId>
   <version>3.9</version>
</dependency>
<dependency>
   <groupId>xml-apis</groupId>
   <artifactId>xml-apis</artifactId>
   <version>1.4.01</version>
</dependency>
<dependency>
   <groupId>org.apache.poi</groupId>
   <artifactId>poi-ooxml</artifactId>
   <version>3.9</version>
   <exclusions>
     <exclusion>
       <artifactId>xml-apis</artifactId>
       <groupId>xml-apis</groupId>
     </exclusion>       
   </exclusions>
</dependency>
查看更多
Melony?
6楼-- · 2020-07-01 09:52

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

查看更多
beautiful°
7楼-- · 2020-07-01 09:53

Add this dependency to work with Apache POI

<dependency>
    <groupId>org.apache.poi</groupId>
    <artifactId>poi</artifactId>
    <version>3.16-beta1</version>
 </dependency>
查看更多
登录 后发表回答