That was it! I changed my build architecture to load my custom tasks outside of ant/lib and everything is peachy. Sheesh! Now I know why loading xdoclet under ant/lib is such a big no-no.

Clifton C. Craig, Software Engineer
Intelligent Computer Systems -  A Division of GBG
2101 Embassy Drive
Lancaster, PA  17603

Phone: 717-295-7977 ext. 621
Fax: 717-295-7683
[EMAIL PROTECTED]
[EMAIL PROTECTED]




Clifton C. Craig wrote:

I'm including snippets below. What I don't understand is why it appears like taskdef only loads classes that are located int the same jar. I mean, My XJavadocUpdate task is loaded out of a jar named icstask.jar located under ant/lib. (The last sentence just gave me a clue but let me finish typing 1st.) It directly references classes found in the xjavadoc.jar under XDOCLET_HOME. Ok, so now I think I understand my problem. It's that weird ant/lib classloading issue. Since my classes are loaded into the Ant lib classloader's classpath it gets 1st crack at loading my tasks. This class loader knows nothing about the extra classpath info under the taskdef element. Now the taskdef element does dynamic classloading (I assume with it's own CLASSLOADER assembled with the given path info) to find the requested task. It delegates to the ant lib classloader which coughs when it sees my class but not the xjavadoc.jar classes. This is now starting to make sense to me. I knew I just needed to talk it out with someone intelligent. So Now I believe my issue is related to storing my custom task jar under ant/lib. Sounds like a highly suspect cause. Could you please look over what I've already included below to see if this is the likely problem?


This is a snippet from my custom task. Like I said it imports and uses XJavadoc classes directly:
import xjavadoc.ant.XJavadocTask;
//other imports...
/**
* Created by IntelliJ IDEA.
* User: CliftonCraig
* Date: Mar 18, 2004
* Time: 4:19:18 PM
* To change this template use Options | File Templates.
*/
public class XJavaDocUpdate extends XJavadocTask
{
//Task logic
}


This is my build file:
<?xml version="1.0"?>
<project default="test" basedir="." name="Test">
<description>
This is a test script for experimental use.
</description>
<!-- =================================================================== -->
<!-- Basic build targets for the project -->
<!-- =================================================================== -->
<property name="project.base" location="../../"/>


<target name="init" unless="init.already.called">
<property name="init.already.called" value="true"/>
<property name="base.ant.folder" value="apache-ant-1.6.0"/>
<property name="tools.dir" location="${project.base}/tools"/>
<property name="xdoclet.base.folder" value="xdoclet-1.2"/>
<property name="xdoclet.home" location="${tools.dir}/${xdoclet.base.folder}"/>
<path id="xdoclet.jars">
<fileset dir="${xdoclet.home}" includes="*.jar"/>
</path>
<property name="xdoc.jars.prop" refid="xdoclet.jars"/>
<echo>XDoclet Jars prop= ${xdoc.jars.prop}</echo>
<taskdef resource="com/icsaward/award/ant/tasks/taskdef.properties">
<classpath>
<pathelement location="${project.base}/tools/${base.ant.folder}/lib/icstasks.jar"/>
<path refid="xdoclet.jars"/>
</classpath>
</taskdef>
</target>


<target name="test" depends="init">
<typedef name="ejbfilter" classname="xjavadoc.ant.XJavadocFilter" classpathref="xdoclet.jars"/>
<xjavadocupdate destdir="d:/misc"
failonerror="no" deploydesc="ejb-jar.xml,jonas-ejb-jar.xml">
<fileset dir="${src.dir}" includes="${neware.path}/server/sb/em/address/*.java">
<or>
<ejbfilter>
<parameter name="implements" value="javax.ejb.EntityBean"/>
</ejbfilter>
<ejbfilter>
<parameter name="implements" value="javax.ejb.SessionBean"/>
</ejbfilter>
</or>
</fileset>
</xjavadocupdate>
</target>


</project>

Here's what the build output looks like:
D:\scm\build.bat -f D:\scm\tools\scripts\test.xml -v
Your environment is now configured for apache-ant-1.6.0.
Using classpath: ""
Apache Ant version 1.6.0 compiled on December 18 2003
Buildfile: D:\scm\tools\scripts\test.xml
Detected Java version: 1.4 in: D:\j2sdk1.4.2\jre
Detected OS: Windows XP
parsing buildfile D:\scm\tools\scripts\test.xml with URI = file:///D:/scm/tools/scripts/test.xml
Project base dir set to: D:\scm\tools\scripts
Build sequence for target `test' is [init, test]
Complete build sequence is [init, test, ]


init:
XDoclet Jars prop= D:\scm\tools\xdoclet-1.2\commons-collections-2.0.jar;D:\scm\tools\xdoclet-1.2\commons-logging.jar;D:\scm\tools\xdoclet-1.2\log4j.jar;D:\scm\tools\xdoclet-1.2\maven-xdoclet-plugin-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-apache-module-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-bea-module-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-borland-module-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-caucho-module-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-de-locale-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-ejb-module-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-exolab-module-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-fr_FR-locale-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-hibernate-module-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-hp-module-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-ibm-module-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-java-module-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-jboss-module-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-jdo-module-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-jmx-module-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-libelis-module-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-macromedia-module-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-mockobjects-module-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-mvcsoft-module-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-mx4j-module-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-objectweb-module-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-oracle-module-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-orion-module-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-portlet-module-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-pramati-module-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-pt_BR-locale-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-solarmetric-module-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-sun-module-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-sybase-module-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-tjdo-module-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-web-module-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-webwork-module-1.2.jar;D:\scm\tools\xdoclet-1.2\xdoclet-xdoclet-module-1.2.jar;D:\scm\tools\xdoclet-1.2\xjavadoc-1.0.2.jar



BUILD FAILED
D:\scm\tools\scripts\test.xml:24: taskdef A class needed by class com.icsaward.award.ant.tasks.XJavaDocUpdate cannot be found: xjavadoc/ant/XJavadocTask
at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:501)
at org.apache.tools.ant.taskdefs.Definer.loadProperties(Definer.java:318)
at org.apache.tools.ant.taskdefs.Definer.execute(Definer.java:251)
at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:306)
at org.apache.tools.ant.Task.perform(Task.java:401)
at org.apache.tools.ant.Target.execute(Target.java:338)
at org.apache.tools.ant.Target.performTasks(Target.java:365)
at org.apache.tools.ant.Project.executeTarget(Project.java:1237)
at org.apache.tools.ant.Project.executeTargets(Project.java:1094)
at org.apache.tools.ant.Main.runBuild(Main.java:669)
at org.apache.tools.ant.Main.startAnt(Main.java:220)
at org.apache.tools.ant.launch.Launcher.run(Launcher.java:215)
at org.apache.tools.ant.launch.Launcher.main(Launcher.java:90)
Caused by: java.lang.NoClassDefFoundError: xjavadoc/ant/XJavadocTask
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at org.apache.tools.ant.AntClassLoader.findBaseClass(AntClassLoader.java:1218)


at org.apache.tools.ant.AntClassLoader.loadClass(AntClassLoader.java:994)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:219)
at org.apache.tools.ant.taskdefs.Definer.addDefinition(Definer.java:471)
... 12 more


Clifton C. Craig, Software Engineer
Intelligent Computer Systems -  A Division of GBG
2101 Embassy Drive
Lancaster, PA  17603

Phone:  717-295-7977 ext. 621
Fax:  717-295-7683
[EMAIL PROTECTED]
[EMAIL PROTECTED]


Konstantin Priblouda wrote:


--- "Clifton C. Craig" <[EMAIL PROTECTED]> wrote:


Hello,

I've been trying to use the XJavadoc task shipped in
the xjavadoc jar with XDoclet via one of my custom tasks. This may
sound like more of an Ant question but I'm sure there's an expert out
there that can help me. What I'm doing is defining a custom task as an
extension of the XJavadocTask. I then compile and jar this extension
and define it via a taskdef element in my build. The taskdef element
includes a classpath which references my custom tasks jar and the
xjavadoc jar. When I run my build Ant complains that it cannot find the xjavadoc
classes that my custom task directly reference. So now I say,
"what's the deal?" Do I have to jar my classes in the SAME jar as XJavadoc
and point the taskdef to this jar? It works if I copy the xjavadoc jar
into the ant/lib folder but I thought I read some where that you shouldn't
place XDoclet jars under ant/lib. I couldn't just copy that one jar
there and live with it. I'd have to copy everything from XDoclet if only for
the consistency of my app. Can someone tell me how you're supposed to
use this stuff?




putting jars into ants lib directory is a big no no. (
unless you are calling for trouble and obscure
classloading problems )

can you show your build.xml ? errors?

regards,

=====
----[ Konstantin Pribluda ( ko5tik ) ]----------------
Zu Verst�rkung meines Teams suche ich ab Sofort einen
Softwareentwickler[In] f�r die Festanstellung. Arbeitsort: Mainz Skills: Programieren, Kentnisse in OpenSource-Bereich
----[ http://www.pribluda.de ]------------------------


__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html


------------------------------------------------------- This SF.Net email is sponsored by: IBM Linux Tutorials Free Linux tutorial presented by Daniel Robbins, President and CEO of GenToo technologies. Learn everything from fundamentals to system administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click _______________________________________________ xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user






-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user




-------------------------------------------------------
This SF.Net email is sponsored by: IBM Linux Tutorials
Free Linux tutorial presented by Daniel Robbins, President and CEO of
GenToo technologies. Learn everything from fundamentals to system
administration.http://ads.osdn.com/?ad_id70&alloc_id638&op=click
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to