ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Langr <>
Subject custom taskdef requires Ant classloading of external JARs
Date Tue, 22 Feb 2005 18:57:00 GMT

I'm using Ant 1.6.1 under WinXP SP2.

I wrote a custom task, deployToCache, that reads from a URL; the URL can
sometimes be https. Here's the taskdef definition:

   <taskdef name="deployToCache"
          <pathelement location="./DeployUtils.jar" />

The custom task requires jnet.jar, jsse.jar, and jcert.jar. The relevant


Access to the secure URL works fine when the code is run standalone, but
when it's run as the Ant task, the provider isn't getting picked up. I'm
aware that the custom task runs in Ant's Java process. If I change ant.bat
and alter Ant's classpath in the batch file, things work fine:

set SECUREJARS=c:\IWS251\CMBuild\ClassFiles\2512Classes
"%_JAVACMD%" %ANT_OPTS% -classpath
;%SECUREJARS%\jcert.jar" "-Dant.home=%ANT_HOME%" %ANT_ARGS% -lib "%CLASSPATH%"
goto end

If I put the three jars (jnet, jsse, jcert) in Ant's lib directory, it does
not work. 

I tried also enhancing the <classpath> portion of the taskdef and adding the
JARs as pathelements:

   <taskdef name="deployToCache"
          <pathelement location="./DeployUtils.jar" />
          <pathelement location="./jsse.jar" />
          <pathelement location="./jcert.jar" />
          <pathelement location="./jnet.jar" />

That didn't work.

I looked at the Ant FAQ and didn't see anything that would help. The closest
entry seemed to be "<style> or <junit> ignores my <classpath>." 

I'd rather not require changes to ant.bat. I also tried setting the
CLASSPATH prior to executing ant.bat. Unfortunately this only sets the -lib
parameter on the Ant Java app command line; same problem.

One thing that does work is moving the three jars to the ext classloader
directory (jre/lib/ext), but I don't necessarily want to do that.

Thanks for any help.


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

View raw message