ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William Ferguson" <william_fergu...@versata.com>
Subject RE: Setting classpath for Taskdef
Date Mon, 10 Dec 2001 02:29:11 GMT
OK.

If I remove optional.jar from %ANT_HOME%\lib but define it in the MimeMail
taskdef along with J2ee.jar,
then Ant can't find the MimeMail task.

ie

	<taskdef name="mimeMail"
classname="org.apache.tools.ant.taskdefs.optional.net.MimeMail">
		<classpath>
			<pathelement location="${project}/lib/j2ee/j2ee.jar"/>
			<pathelement location="${project}/tools/ant/lib/optional.jar"/>
		</classpath>
	</taskdef>

Gives

D:\source\main\buildScripts\NightlyBuild.xml:44: taskdef class
org.apache.tools.ant.taskdefs.optional.net.MimeMail cannot be found
        at
org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:176)
        at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:114)

etc

But if I define the taskdef for MimeMail as above and don't remove
optional.jar from %ANT_HOME%\lib then I get


D:\source\main\buildScripts\NightlyBuild.xml:172: Could not create task of
type: mimeMail due to java.lang.NoClassDefFoundError: javax/mail/Address
        at org.apache.tools.ant.Project.createTask(Project.java:509)
        at
org.apache.tools.ant.UnknownElement.makeTask(UnknownElement.java:148)
        at
org.apache.tools.ant.UnknownElement.maybeConfigure(UnknownElement.java:83)
        at org.apache.tools.ant.Task.perform(Task.java:216)


So it wuld seem that Ant definitely requires the optional.jar in its
classpath when executed, and can't pick it up from the taskdef classpath
attribute.

It also seems that Ant requires that any libraries that are needed by an
optional task to also be included in Ant's classpath.
Ie these classes can't be specified via the classpath attribute of taskdef.

So either I'm doing something totally wrong, or the classpath attribute
doesn't appear to function.

William


> -----Original Message-----
> From: Steve Loughran [mailto:steve_l@iseran.com]
> Sent: Monday, 10 December 2001 12:55
> To: Ant Users List
> Subject: Re: Setting classpath for Taskdef
>
>
>
> ----- Original Message -----
> From: "William Ferguson" <william_ferguson@versata.com>
> To: "'Ant Users List'" <ant-user@jakarta.apache.org>
> Sent: Sunday, December 09, 2001 4:32 PM
> Subject: RE: Setting classpath for Taskdef
>
>
> > Thanks Eric,
> >
> > optional.jar is already in %ANT_HOME%\lib and it finds it OK.
> > It's just not finding j2ee.jar
>
> That is because the task in optional.jar is in a different
> classloader from
> the j2ee jar.
>
> > If I explicitly add j2ee.jar to the classpath when I invoke Ant then
> > everything works OK.
> > But that is not an optimal solution.
>
> It is all you get unless you pull optional.jar from ant\lib
> and include it
> in the classpath you spec for MimeMail.
>
>
> --
> To unsubscribe, e-mail:
> <mailto:ant-user-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
> <mailto:ant-user-help@jakarta.apache.org>
>


--
To unsubscribe, e-mail:   <mailto:ant-user-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:ant-user-help@jakarta.apache.org>


Mime
View raw message