Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Required maven dependencies for Apache POI to work

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?

like image 486
Mahmoud Saleh Avatar asked Nov 20 '11 14:11

Mahmoud Saleh


People also ask

What are the dependencies required for Apache POI?

The OOXML jars require a stax implementation, but now that Apache POI requires Java 8, that dependency is provided by the JRE and no additional stax jars are required.

Which of the following dependencies will be added to POM xml to download Apache POI libraries?

xml file in the project. Maven dependency is added when the pom. xml file is saved after copying the maven dependency.

How do I use Apache POI in Maven project?

To install POI, download a bundle of Jar files from official site poi.apache.org/download.html and use in the application. Following are the minimum required Jars. We can also set dependency in maven project. It need jar files that are used to run the application.

How does Apache POI work?

Apache POI is an open-source java library to create and manipulate various file formats based on Microsoft Office. Using POI, one should be able to perform create, modify and display/read operations on the following file formats.


2 Answers

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> 
like image 167
Sri Sankaran Avatar answered Sep 28 '22 15:09

Sri Sankaran


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> 
like image 23
Laura Liparulo Avatar answered Sep 28 '22 15:09

Laura Liparulo