Hello Patrick,
it is possible to do this using the classloader task of jtools
<taskdef name="classloadertask"
classname="org.apache.tools.ant.taskdefs.ClassloaderTask">
<classpath>
<fileset dir="${ivy.lib.dir}/classloadertask"/>
</classpath>
</taskdef>
<path id="all.mail.cp">
<fileset dir="${ivy.lib.dir}/mail">
<include name="*.jar"/>
</fileset>
</path>
<classloadertask classpathRef="all.mail.cp" loader="thread"/>
here is the snippet of my ivy.xml with the dependencies
<dependency org="sun" name="javamail" rev="1.3.3" conf="mail->default"/>
<dependency org="sun" name="jaf" rev="1.1.1" conf="mail->default"/>
<dependency org="sourceforge" name="jtools" rev="1.0-RC2"
conf="classloadertask->default">
<artifact name="ant-classloadertask" type="jar"/>
</dependency>
so you do not need to redefine the mail task but put artificially
activation.jar and mail.jar on the thread class loader.
Regards,
Antoine
On 1/19/2011 4:31 AM, Patrick Martin wrote:
Hello,
Is it possible to use the<mail> task without having activation.jar
and mail.jar in the ant lib folder?
I tried to redefine the mail task this way:
<taskdef name="mymail"
classname="org.apache.tools.ant.taskdefs.email.MimeMailer">
<classpath>
<pathelement location="${ant.home}/lib/ant-javamail.jar" />
<!--
same with and without this line -->
<pathelement location="a/mail.jar" />
<pathelement location="a/activation.jar" />
</classpath>
</taskdef>
But it did not work. I keep on getting the following error:
D:\tmp\build.xml:7: taskdef A class needed by class
org.apache.tools.ant.taskdefs.email.MimeMailer cannot be found:
javax/mail/MessagingException
using the classloader AntClassLoader[D:\tmp\a\activation.jar]
at
org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:627)
at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:239)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at
org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
at org.apache.tools.ant.Task.perform(Task.java:348)
at org.apache.tools.ant.Target.execute(Target.java:390)
at org.apache.tools.ant.Target.performTasks(Target.java:411)
at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1399)
at org.apache.tools.ant.Project.executeTarget(Project.java:1368)
at
org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
at org.apache.tools.ant.Project.executeTargets(Project.java:1251)
at org.apache.tools.ant.Main.runBuild(Main.java:809)
at org.apache.tools.ant.Main.startAnt(Main.java:217)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:280)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:109)
Caused by: java.lang.NoClassDefFoundError: javax/mail/MessagingException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:242)
at
org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:594)
... 18 more
I am using ant 1.8.2.
Thanks,
Patrick
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org