I've found the error : in the xdoclet.xml the << parent-task-class="xdoclet.modules.ejb.EjbDocletTask" >> must be replace by : << parent-task-class="xdoclet.DocletTask" >> as in the build.xml the xdoclet.DocletTask was declared as doclet task
Quoting [EMAIL PROTECTED]: > Hi, > > I've made a custom subtask which extends <<TemplateSubTask>>, I've put th= > e > xdoclet.xml in META-INF directory and this CustomSubTask in / directpry o= > f my > jar file and put the jar file in the classpath of the application in whic= > h 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 cont= > aining > the corresponding subtask class is on the classpath specified in the <tas= > kdef> > that defined {2}. > at xdoclet.DocletTask.createDynamicElement(DocletTask.java:341) > at > org.apache.tools.ant.IntrospectionHelper.createElement(IntrospectionHelpe= > r.java:510) > >> > > The xdoclet.xml : > << > <?xml version=3D"1.0" encoding=3D"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=3D"example" > implementation-class=3D"ExampleSubTask" > parent-task-class=3D"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=20 > * file per class. > * > * @author Denis Boutin > * @version $Revision: 1.0 $ > * @ant.element name=3D"example"=20 > * display-name=3D"Example Subtask"=20 > * parent=3D"xdoclet.DocletTask" > */ > public class ExampleSubTask extends TemplateSubTask { > =20 > // the {0} will be replaced with the name of the class > private final static String OUTPUT =3D "{0}.txt"; > =20 > private final static String TEMPLATE =3D "resources/test2.xdt"; > > // setting from subtask in build.xml > private String m_setting; > > /** > * Default constructor > */ > public ExampleSubTask() {=20 > setDestinationFile(OUTPUT); > setTemplateURL(getClass().getResource(TEMPLATE)); > } > > /** > * Called by Ant by reflection with "setting" attribute. =20 > */ > public void setSetting(String s) { > m_setting =3D 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=3D"testXDoclet" basedir=3D"." default=3D"test-template"> > > > <target name=3D"prepare.classpath"> > <path id=3D"classpath"> > <fileset dir=3D"lib/"> > <include name=3D"**/*.jar"/> > </fileset> > </path> > </target> > > > <target name=3D"test-template" depends=3D"prepare.classpath"> > <delete dir=3D"test-template"/> > <taskdef name=3D"doclet" > classname=3D"xdoclet.DocletTask" > classpathref=3D"classpath"/> > =20 > <doclet destdir=3D"test-template"> > <fileset dir=3D"test" includes=3D"**/*.java"/> > <!-- demonstrate one output file for whole source tree=20 > typically this template would contain > XDtClass:forAllClasses here.=20 > --> > <!-- <template templateFile=3D"test.xdt" destinationFile=3D"output= > .txt"/> --> > <example setting=3D"tagada"/> > </doclet> > </target> > > <target name=3D"compile-xdoclet" depends=3D"prepare.classpath"> > <javac srcdir=3D"newTask/" classpathref=3D"classpath" /> > </target> > > > </project> > >> > > > Do you see something wrong here ?=20 > > 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_id=3149&alloc_id=8166&op=click > _______________________________________________ > xdoclet-user mailing list > [EMAIL PROTECTED] > https://lists.sourceforge.net/lists/listinfo/xdoclet-user > ------------------------------------------------------- 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