defining the classpath for an ANT task in an ANT build file

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
Ron Van den Branden
Posts: 48

defining the classpath for an ANT task in an ANT build file

Wed Nov 09, 2016 5:44 pm


I am maintaining a framework that defines an ANT transformation task that (among others) executes a FOP transformation. After an Oxygen update, I noticed the included FOP distribution had been updated, so I had to update the jar file references.

In order to improve future compatibility, I tried to generalize those jar file references by replacing the version numbers with asterisks. In Oxygen-18.1 it works perfectly if I pass following jars in the "libraries" section of the ANT scenario configuration:

Code: Select all

<field name="extensionURLs">

Yet, the wildcard expansion for those "extension URLs" seems to be a recent feature introduced with Oxygen-18. In earlier versions this won't work, and hence this approach introduces a backward compatibility issue I would like to solve.

Therefore, I've tried by removing the wildcard-URLs from the "extensionURLs" section, and instead define them in the FOP task definition in the ANT build file that's being called:

Code: Select all

  <taskdef name="fop" classname="">
      <fileset dir="${oxygen.home}/lib">
        <include name="fop.jar"/>
        <include name="batik-all-*.jar"/>
        <include name="commons-logging-*.jar"/>
        <include name="xmlgraphics-commons-*.jar"/>
        <include name="commons-io-*.jar"/>
        <include name="avalon-framework-*.jar"/>

If I initialize the ANT scenario while passing ${oxygenInstallDir} for the ANT script's ${oxygen.home} property, that seems to work partially, but still failing with following error:

C:\Users\ron\AppData\Roaming\com.oxygenxml\extensions\v18.1\frameworks\myframework\jtei-pdf.xml:6: taskdef A class needed by class cannot be found: org/apache/fop/apps/FOPException
using the classloader AntClassLoader[C:\Program Files\Oxygen XML Editor 18\lib\avalon-framework-api-4.3.1.jar;C:\Program Files\Oxygen XML Editor 18\lib\avalon-framework-impl-4.3.1.jar;C:\Program Files\Oxygen XML Editor 18\lib\batik-all-1.8.jar;C:\Program Files\Oxygen XML Editor 18\lib\commons-io-1.3.1.jar;C:\Program Files\Oxygen XML Editor 18\lib\commons-logging-1.2.jar;C:\Program Files\Oxygen XML Editor 18\lib\fop.jar;C:\Program Files\Oxygen XML Editor 18\lib\xmlgraphics-commons-2.1.jar]

From this error message, I gather that the wildcards are correctly resolved to the matching file names. Yet, apparently the classpath is not set correctly, since the org/apache/fop/apps/FOPException class can't be found, even though it is present in C:\Program Files\Oxygen XML Editor 18\lib\fop.jar.

I have the feeling I'm really close to a future and backward compatible solution... Am I still missing anything in the classpath definition for this FOP task?

Kind regards,

Posts: 5757

Re: defining the classpath for an ANT task in an ANT build file

Wed Nov 09, 2016 6:20 pm

Hi Ron,

I answered you on the opened issue.

Radu Coravu
<oXygen/> XML Editor

Return to “Common Problems”

Who is online

Users browsing this forum: No registered users and 3 guests