Eric,
First I would definitely use the current CVS version if you aren't already
Then your template should look something like this
xyz=<XDtClass:className/>
Also I think you might want to use the templatedoclet task and note the
format of the destinationfile, see attached email for details
<taskdef name="templatedoclet" classname="xdoclet.DocletTask">
</taskdef>
<templatedoclet sourcepath="${src.dir}" destdir="${build.dir}"
classpathref="xdoclet.classpath">
<fileset dir="${src.dir}">
<include name="**/*.java" />
</fileset>
<template templateFile="temp.template"
destinationfile="temp{0}.properties"></template>
</templatedoclet>
You should have better luck set up that way. I use custom templates all the
time
Cheers,
Matthew
---
j. matthew pryor <[EMAIL PROTECTED]>
versata, inc <www.versata.com>
> -----Original Message-----
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]]On Behalf Of Erik
> Hatcher
> Sent: Friday, January 04, 2002 12:23 PM
> To: [EMAIL PROTECTED]
> Subject: [Xdoclet-user] Re: NullPointerException <template> - help!
>
>
> I forgot to provide my temp.template file. It simply contains this:
>
> xyz=<XDoclet:className/>
>
> I tried more complex stuff, but everything I've tried gave an error, so I
> put it down the simplest thing I could and still get the error.
>
> This is my first attempt at writing a custom template. I use the
> <info>/@todo stuff and that all works fine for me though.
>
> Erik
>
>
> ----- Original Message -----
> From: "Erik Hatcher" <[EMAIL PROTECTED]>
> To: <[EMAIL PROTECTED]>
> Sent: Thursday, January 03, 2002 8:16 PM
> Subject: NullPointerException <template> - help!
>
>
> > I'm using this build.xml piece:
> >
> > <xdoclet sourcepath="${src.dir}"
> > destdir="${build.dir}"
> > classpathref="xdoclet.classpath">
> > <fileset dir="${src.dir}">
> > <include name="**/*.java" />
> > </fileset>
> > <template templateFile="temp.template"
> > destinationfile="temp.properties"></template>
> > </xdoclet>
> >
> > [xdoclet] (TemplateEngine.invokeMethod 524 ) Invoking method
> > failed:
> > lassName , line=1 of template file: C:\test\temp.template
> > [xdoclet] java.lang.NullPointerException
> > [xdoclet] at xdoclet.SubTask.className(SubTask.java:576)
> > [xdoclet] at java.lang.reflect.Method.invoke(Native Method)
> > [xdoclet] at
> > xdoclet.util.TemplateEngine.invokeMethod(TemplateEngine.java
> > 520)
> > [xdoclet] at
> > xdoclet.util.TemplateEngine.invokeContentMethod(TemplateEngi
> > e.java:627)
> > [xdoclet] at
> > xdoclet.util.TemplateEngine.generate(TemplateEngine.java:428
> >
> > [xdoclet] at
> > xdoclet.SubTask.generateFileUsingTemplate(SubTask.java:3052)
> > [xdoclet] at
> xdoclet.TemplateSubTask.execute(TemplateSubTask.java:33)
> > [xdoclet] at
> xdoclet.DocletTask$DocletMain.start(DocletTask.java:284)
> > [xdoclet] at java.lang.reflect.Method.invoke(Native Method)
> > [xdoclet] at
> > com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvoker.jav
> >
> > I've tried this with both Ant 1.4.1 and the latest (from CVS)
> version and
> > get the same error.
> >
> > I'm using XDoclet 1.0.1 release version.
> >
> > Any help is greatly appreciated.
> >
> > Thanks,
> > Erik
> >
> >
> >
>
>
> _______________________________________________
> Xdoclet-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/xdoclet-user
>
--- Begin Message ---
You are right Mathew, it calls it for ALL.
The convention is to use destinationfile="{0}.txt" if you want
<template/> to first set currentclass and then call the template PER
CLASS (useful when you want to generate remote interface for each
class). But if you don't include the {0} then it assumes you want to do
the looping yourself by XDtCkass:forAllClasses FOR ALL SPECIFIED CLASSES
(useful when your generated stuff has the list itself, like
<enterprise-beans/> in ejb-jar.xml).
Anyway, there should be a problem with the list, I receive emails 10-12
hours after being posted!!
Ara.
> -----Original Message-----
> From: [EMAIL PROTECTED] [mailto:xdoclet-user-
> [EMAIL PROTECTED]] On Behalf Of J. Matthew Pryor
> Sent: Friday, November 30, 2001 7:45 AM
> To: Janos Mucsi; [EMAIL PROTECTED]
> Subject: RE: [Xdoclet-user] unable to run <templatedoclet>
>
> This is just a hunch based on a brief inspection of the code, but try
> setting destinationfile="{0}.txt" in your templatedoclet subtask to
tell
> the
> template doclet subtask to call the template on a per class basis, I
think
> it is calling it with all the classes at once in which case your
template
> should probably start with an iteration
>
> As I say this is just a W.A.G.
>
> Cheers,
> jmp
>
> > -----Original Message-----
> > From: [EMAIL PROTECTED]
> > [mailto:[EMAIL PROTECTED]]On Behalf Of Janos
> > Mucsi
> > Sent: Friday, November 30, 2001 2:38 PM
> > To: '[EMAIL PROTECTED]'
> > Subject: [Xdoclet-user] unable to run <templatedoclet>
> >
> >
> > Hi All
> >
> > Create a file, called mytemplate.j:
> >
> > <message-selector>
> > <XDtClass:ifHasClassTag tagName="ejb:message-selector">
> > <XDtClass:classTagValue tagName="ejb:message-selector"
> > paramName="selector" paramNum="0"/>
> > </XDtClass:ifHasClassTag>
> > </message-selector>
> >
> > Create a java file called Input.java:
> >
> > /**
> > * @ejb:message-selector selector=kefe
> > */
> > public class Input {
> >
> >
> > }
> >
> > Paste this into build.xml and run ant:
> >
> > <target name="mytemplates" depends="prepare">
> > <echo>Entering target mytemplates</echo>
> > <taskdef name="templatedoclet" classname="xdoclet.DocletTask"
> > classpath="${xdoclet.jar.path};${log4j.jar.path};${ant.jar.path}" />
> >
> > <templatedoclet sourcepath="${java.dir}"
> > destdir="${generated.java.dir}" classpathref="project.class.path"
> > excludedtags="@version,@author" >
> >
> > <fileset dir="${java.dir}">
> > <include name="Input.java" />
> > </fileset>
> >
> > <template templateFile="src/java/mytemplate.j"
> > destinationfile="mytemplatetest.txt"></template>
> >
> > </templatedoclet>
> > </target>
> >
> >
> > You will get:
> >
> > [templatedoclet] (TemplateEngine.invokeMethod 743 )
> > Invoking method
> > fail
> > ed: ifHasClassTag , line=4 of template file:
> > D:\xdoclet_cvs_src\xdoclet\dist\sam
> > ples\src\java\mytemplate.j
> > [templatedoclet] java.lang.NullPointerException
> > [templatedoclet] at
> > xdoclet.util.DocletUtil.getTagsByName(DocletUtil.java
> > :84)
> > [templatedoclet] at
> > xdoclet.tags.AbstractProgramElementTagsHandler.ifHasT
> > ag_Impl(AbstractProgramElementTagsHandler.java:307)
> > [templatedoclet] at
> > xdoclet.tags.ClassTagsHandler.ifHasClassTag(ClassTags
> > Handler.java:344)
> > [templatedoclet] at java.lang.reflect.Method.invoke(Native
> Method)
> > [templatedoclet] at
> > xdoclet.template.TemplateEngine.invokeMethod(Template
> > Engine.java:735)
> > [templatedoclet] at
> > xdoclet.template.TemplateEngine.invokeBlockMethod(Tem
> > plateEngine.java:826)
> > [templatedoclet] at
> > xdoclet.template.TemplateEngine.handleBlockTag(Templa
> > teEngine.java:687)
> > [templatedoclet] at
> > xdoclet.template.TemplateEngine.handleTag(TemplateEng
> > ine.java:423)
> > [templatedoclet] at
> > xdoclet.template.TemplateEngine.generate(TemplateEngi
> > ne.java:305)
> > [templatedoclet] at
> > xdoclet.template.TemplateEngine.start(TemplateEngine.
> > java:368)
> > [templatedoclet] at
> > xdoclet.TemplateSubTask.startEngine(TemplateSubTask.j
> > ava:430)
> > [templatedoclet] at
> > xdoclet.TemplateSubTask.startProcess(TemplateSubTask.
> > java:264)
> > [templatedoclet] at
> > xdoclet.TemplateSubTask.execute(TemplateSubTask.java:
> > 188)
> > [templatedoclet] at
> > xdoclet.DocletTask$DocletMain.start(DocletTask.java:4
> > 03)
> > [templatedoclet] at java.lang.reflect.Method.invoke(Native
> Method)
> > [templatedoclet] at
> > com.sun.tools.javadoc.DocletInvoker.invoke(DocletInvo
> > ker.java:193)
> > [templatedoclet] at
> > com.sun.tools.javadoc.DocletInvoker.start(DocletInvok
> > er.java:95)
> > [templatedoclet] at
> com.sun.tools.javadoc.Main.main(Main.java:233)
> > [templatedoclet] xdoclet.template.TemplateException: Invoking
> > method failed:
> > ifH
> > asClassTag , line=4 of template file:
> > D:\xdoclet_cvs_src\xdoclet\dist\samples\sr
> > c\java\mytemplate.j ,exception: null
> >
> > Why? Thanks.
> >
> > Janos Mucsi
> > Engineer
> > Altoweb, Inc.
> > 650-251-1561
> > [EMAIL PROTECTED]
> >
> >
> > _______________________________________________
> > Xdoclet-user mailing list
> > [EMAIL PROTECTED]
> > https://lists.sourceforge.net/lists/listinfo/xdoclet-user
> >
>
>
> _______________________________________________
> Xdoclet-user mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/xdoclet-user
_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com
--- End Message ---