Hi, I've made a custom subtask which extends <<TemplateSubTask>>, I've put the xdoclet.xml in META-INF directory and this CustomSubTask in / directpry of my jar file and put the jar file in the classpath of the application in which I need to use this SubTask. However, when I'm launching the build process, I've got :
<< Can't create a example element under doclet. Make sure the jar file containing the corresponding subtask class is on the classpath specified in the <taskdef> that defined {2}. at xdoclet.DocletTask.createDynamicElement(DocletTask.java:341) at org.apache.tools.ant.IntrospectionHelper.createElement(IntrospectionHelper.java:510) >> The xdoclet.xml : << <?xml version="1.0" encoding="UTF-8"?> <!-- <!DOCTYPE xdoclet-module PUBLIC "-//XDoclet Team//DTD XDoclet Module 1.0//EN" "http://xdoclet.sourceforge.net/dtd/xdoclet-module_1_0.dtd"> --> <xdoclet-module> <subtask name="example" implementation-class="ExampleSubTask" parent-task-class="xdoclet.modules.ejb.EjbDocletTask" /> </xdoclet-module> >> The class ExampleSubTask.java : << import java.util.*; import java.net.URL; import xjavadoc.XClass; import xjavadoc.XCollections; import xjavadoc.XTag; import xjavadoc.TagIterator; import xdoclet.TemplateSubTask; import xdoclet.XDocletException; import xdoclet.util.Translator; /** * Example subtask that generates a .txt file for each class, with * a simple list of methods in each class. Generates one output * file per class. * * @author Denis Boutin * @version $Revision: 1.0 $ * @ant.element name="example" * display-name="Example Subtask" * parent="xdoclet.DocletTask" */ public class ExampleSubTask extends TemplateSubTask { // the {0} will be replaced with the name of the class private final static String OUTPUT = "{0}.txt"; private final static String TEMPLATE = "resources/test2.xdt"; // setting from subtask in build.xml private String m_setting; /** * Default constructor */ public ExampleSubTask() { setDestinationFile(OUTPUT); setTemplateURL(getClass().getResource(TEMPLATE)); } /** * Called by Ant by reflection with "setting" attribute. */ public void setSetting(String s) { m_setting = s; } /** * This method is invoked once for each class. If we wanted to * do anything different, do it here. */ protected void generateForClass(XClass clazz) throws XDocletException { System.out.println("Setting is: " + m_setting); // call template engine super.generateForClass(clazz); } } >> build.xml : << <project name="testXDoclet" basedir="." default="test-template"> <target name="prepare.classpath"> <path id="classpath"> <fileset dir="lib/"> <include name="**/*.jar"/> </fileset> </path> </target> <target name="test-template" depends="prepare.classpath"> <delete dir="test-template"/> <taskdef name="doclet" classname="xdoclet.DocletTask" classpathref="classpath"/> <doclet destdir="test-template"> <fileset dir="test" includes="**/*.java"/> <!-- demonstrate one output file for whole source tree typically this template would contain XDtClass:forAllClasses here. --> <!-- <template templateFile="test.xdt" destinationFile="output.txt"/> --> <example setting="tagada"/> </doclet> </target> <target name="compile-xdoclet" depends="prepare.classpath"> <javac srcdir="newTask/" classpathref="classpath" /> </target> </project> >> Do you see something wrong here ? Regards, Denis Boutin. ------------------------------------------------------- This SF.Net email is sponsored by: Oracle 10g Get certified on the hottest thing ever to hit the market... Oracle 10g. Take an Oracle 10g class now, and we'll give you the exam FREE. http://ads.osdn.com/?ad_id149&alloc_id66&op=click _______________________________________________ xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user