POI 3.8 incompatible with dbunit 2.4.9
We are using POI 3.8 in in our application. Our project is using dbunit to load data sets from .xls files, and apparently dbunit is incompatible with POI 3.8. I get the following exception,
It seems dbunit requires POI 3.2. However I cannot downgrade my POI version. Is there any way to fix this problem. In a post I read about downloading dbunit sources and recompile it against poi 3.8. How can this recompiling be done?
There is some discussion about this at the dbunit-bugtracker at http://sourceforge.net/p/dbunit/bugs/332/, unfortunately no update there yet, so it seems dbunit itself does not support this yet.
I was able to recompile dbunit against a newer Apache POI version with the following steps:
- Check out dbunit code from http://dbunit.svn.sourceforge.net/svnroot/dbunit/tags/dbunit-2.4.9 via svn co http://dbunit.svn.sourceforge.net/svnroot/dbunit/tags/dbunit-2.4.9
- Adjust pom.xml to set the poi-dependency to just 3.9, the -FINAL was dropped in newer versions
- run mvn package
- If it fails during compiling because of oracle-jar missing, follow the steps at https://stackoverflow.com/a/18042525/411846
- If tests fail during building, you can try to skip them with mvn -DskipTests=true package
The resulting binary is located under target/dbunit-2.4.9.jar
I have checked the pom file here http://sourceforge.net/p/dbunit/code.git/ci/master/tree/dbunit/
and it still the version of apache poi is 3.2. Unfortunately this version is 5 years old and has less features than 3.9 such as, for instance, the Formatter and a different package for some classes such as Row.
As suggested by centic I have clone the git repo, now the version of dbunit is 2.4.10-SNAPSHOT, I have changed the apache poi version, compiled and installed with the option -Dmaven.test.skip=true.
By default a profile for oracle is activated and this obliged to have oracle jdbc driver which can be disabled or installed in the local repo as suggested above.
All the tests run smooth as before.