ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Devienne <>
Subject RE: How to change classpath for two targets of same build?
Date Fri, 28 May 2004 15:24:23 GMT
> -----Original Message-----
> From: []
> I have not been able to figure out how to use different classpath for two
> different targets of the same build, or for two tasks within a target.  In
> my case, I am trying to use <xmlvalidate> with validation using XSD
> schemas.  This works, but it requires that I use xerces 2.6.2 with
> resolver.jar on the classpath.
> Unfortunately, this config breaks the <xslt> task.  In order to make
> <xslt> run successfully, I have to remove resolver.jar from the classpath.
>  With resolver.jar on the classpath, I get an exception during the parse.
> Removing resolver.jar from the classpath eliminates the exception.
> So the question is -- how can I specify one classpath for the xslt task,
> and a different one for xmlvalidate task.  I tried nested classpath
> elements, but that seems to have no effect.

Hopefully Stefan or Peter with a better understanding of ClassLoading issues
are still online, and can help, but basically this is going to be a though
one to fix...

If you want to run both tasks in the same VM instance, then you're going to
have to pull out Xerces 2.6.2 from Ant's classpath, and manually re-define
the xmlvalidate tasks (<taskdef>) with an explicit classpath (that includes
Xerces 2.6.1), but given the fact that Ant needs an XML parser, and ships
with Xerces by default, you can't really do that... You don't want to have
Xerces twice on the classpath (your 2.6.2 one, and the one that ships with

Then again, recent JDK ship with the Crimson parser, and Ant works fine with
it, so completely remove Xerces from ant/lib, so it's not any more on Ant's
classpath, and taskdef myxmlvalidate with an explicit classpath with Xerces
2.6.2 and resolver.jar.

OTOH, if the only culprit is resolver.jar, remove just that JAR from the Ant
CP, and do the manual taskdef with a classpath that just adds that one.

Of course, it would be highly desirable to be able to use both xmlmvalidate
with Xerces 2.6.2 and resolver.jar... --DD

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message