I am working on a docx-pdf convert task, which should be called from an Ant script. As the basis I use the docx4j libraries. In one of its classes is a getResource call, which tries to access the org/docx4j/convert/out/pdf/viaXSLFO/docx2fo.xslt file, which is stored inside the docx4j JAR.
I wrote the main class and when I start it from the IDE it works fine. Build is also done with Ant and is without error.
The problem is, that when I start to test, it can't access the file mentioned above (the docx2fo.xslt). My taskdef is as it follows:
<taskdef name="docxToPdf" classname="com.tools.docxtopdf.DocxToPdf">
<classpath>
<fileset file="./docxToPdf.jar" />
<fileset dir="../lib">
<include name="*.jar"/>
</fileset>
</classpath>
</taskdef>
The project structure is
root
|- bin
|- lib
|--- library jars (a lot of them)
|- src
|- test
|--- build.xml
|--- docxToPdf.jar
|--- test.docx
|- build.xml
And the error is:
ERROR org.docx4j.utils.ResourceUtils .getResource line 40 - Couldn't get resource: org/docx4j/convert/out/pdf/viaXSLFO/docx2fo.xslt
I tried to move the given file into the docxToPdf.jar, also into the test folder. Several classpath and taskdef definition, but nothing seems to work.
Java 1.7, eclipse, Ant 1.8.4
I would appreciate any help. Thanks!