Friday, February 3, 2017

How to install Apache Poi in Java using Maven (eclipse)

If we need to use apache poi in a Maven Project, we can follow the next simple steps.

We enter to the next link https://mvnrepository.com/artifact/org.apache.poi/poi there we can choose the version of Apache Poi that we prefer, in this example i will use the 3.5 version

We copy the dependency and we download the Jar, as we can see in the following figure
dependency of apache poi for Maven project Java

In this example i saved the Jar in the following directory : D:\Poi\poi-3.15.jar

Later we going to Eclipse, and we press right click on the project -> Run As -> Maven Build...

In the field Goals we put:

 install:install-file -Dfile="D:\jdbc\poi-3.15.jar" -DgroupId=org.apache.poi -DartifactId=poi -Dversion=3.15 -Dpackaging=jar  

Click on Apply And latter click on Run.

Finally we open the pom.xml File and we paste the dependency:

 <dependency>  
    <groupId>org.apache.poi</groupId>  
    <artifactId>poi</artifactId>  
    <version>3.15</version>  
 </dependency>  

Now we can use the apache poi library in our java project with Maven

No comments:

Post a Comment