Ant: [xslt] java.lang.ClassNotFoundException: org.apache.tools.ant.taskdefs.optional.TraXLiaison

I have an Ant build that works fine on Windows, but seems to stand out when I port it to Linux. The problem is here:

[xslt] java.lang.ClassNotFoundException:org.apache.tools.ant.taskdefs.optional.TraXLiaison

I have already tried the following:

  • Put xalan.jar, xercesImpl.jarand xml-apis.jarin the directory $ANT_HOME/lib.
  • Entering them in the classpath from the assembly file
  • Ant installation of additional classes.

I am using an EC2 Linux instance (Amazon Linux AMI Base 64-bit 2011.02.1 Beta (AMI Id: ami-8e1fece7) Amazon Linux AMI Base 2011.02.1, EBS Download, 64-bit architecture with Amazon EC2 AMI Tools.)

The depressing thing is that it worked for me, and then, when I collected everything and transferred it to another machine, the BOTH machines stopped working. :(

+5
source share
2 answers

I was getting the same error from the task junitreport:

build.xml:251: Errors while applying transformations:
java.lang.ClassNotFoundException: org.apache.tools.ant.taskdefs.optional.TraXLiaison

I had to install the ant-traxRPM package to provide this class and fix the error:

$ rpm -ql ant-trax | grep /usr/share/java/ant/ant-trax.jar
/usr/share/java/ant/ant-trax.jar

$ jar tf /usr/share/java/ant/ant-trax.jar | grep TraXLiaison
org/apache/tools/ant/taskdefs/optional/TraXLiaison.class
+8
source

Assuming you are using Ant 1.8.1, it seems like you will push an error, see https://issues.apache.org/bugzilla/show_bug.cgi?id=49712

The org.apache.tools.ant.taskdefs.optional.TraXLiaison class has been moved to ant -nodeps.jar, maybe you just need to put this jar in your path.

+4
source

All Articles