| Classloader problems | Classloader problems 2007-06-07 - By Kevin Jackson
Hi all,
For obscure reasons, I have to redefine the core email task using a taskdef. This is my build file: <path id="jsch.path"> <pathelement location="${src.tools.dir}/jsch/ant-jsch.jar"/> <pathelement location="${src.tools.dir}/jsch/jsch-0.1.33.jar"/> </path> <taskdef name="scp" classname="org.apache.tools.ant.taskdefs.optional.ssh.Scp" classpathref="jsch.path"/>
<taskdef name="sshexec" classname="org.apache.tools.ant.taskdefs.optional.ssh.SSHExec" classpathref="jsch.path"/> <taskdef name="mail" classname="org.apache.tools.ant.taskdefs.email.EmailTask"> <classpath> <pathelement location="${src.tools.dir}/mail/ant-javamail.jar"/> <pathelement location="${src.tools.dir}/mail/mail.jar"/> </classpath> </taskdef>
Now the strange thing is that thescp & sshexec tasks report that they have been over-ridden by the new definitions, and with -debug enabled I can see the correct classes being loaded. The mail task however just reports ' Class org.apache.tools.ant.taskdefs.email.EmailTask loaded from parent loader (parentFirst)'.
Then finally it fails with ClassNotFoundException. This means that the <classpath> is ignored for the mail taskkdef, but is used correctly for the scp/sshexec taskdefs.
I would think it would make sense to treat all taskdefs & classpaths equal...
I cannot copy the jars into ~/.ant/lib, or $ANT_HOME/lib, and I cannot rely on a CLASSPATH variable or an external calling script. The only way I can make what I want to do work is via the taskdefs which honour the <classpath> or classpathref. Does anyone know how to work around this?
Thanks, Kev
--------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscribe@(protected) For additional commands, e-mail: user-help@(protected)
|
|
 |