This is a historical email ;-) The first user question about how to use
XDoclet 2!

XDoclet 2 has a different mechanism than XDoclet 1 to look for templates. In
XDoclet 1 you can specify it with an absolute file path. In XDoclet 2, you
should use a relative file path. XDoclet 2 will then search on the classpath
(the one that was passed to the taskdef) to search for the template. It will
search both in jars and directories and grab the first occurrrance of the
template it can find.

The reason for this is that this is how Velocity works. When I added support
for James' excellent Jelly engine I wanted things to work the same way for
consistency.

So in order to point out a custom Jelly/Velocity template, you should add
the directory where your template is located to the classpath and use a
relative path in the templateFile attribute.

I realise that the name templateFile is quite misleading, so I will change
the name of that property to templatePath.

Also, take a peek here to see what context variables you can access from
your Jelly (or Velocity) script:
http://tinyurl.com/718e (the execute() method).

I hope this gets you going, and I'm looking forward to see what kind of
whizardry you're cooking, James.

Aslak

> I've taken a look around xdoclet2 and it looks pretty neat - its nice to
> see the Jelly plugin :).
>
> I'd like to try experiment with xdoclet2 and might need a hand getting
> started. Basically I'd like to try just running xdoclet2 with a Jelly
> template.
> From looking at the code this looks possible - I'm guessing its something
> like this..
>
>
> <goal name="dummy-jelly" prereqs="java:compile">
>
>   <taskdef name="xdoclet"
>            classname="xdoclet.ant.XDocletTask"
>            classpathref="xdoclet.class.path"/>
>
>   <mkdir dir="${maven.build.dir}/tmp"/>
>
>   <xdoclet>
>     <fileset dir="${maven.src.dir}/testdata/xtag/java"/>
>
>     <jelly
templateFile="${maven.src.dir}/test/templates/JellyGeneratorTest.jelly"
>            destination="${maven.build.dir}/tmp" filename="{0}.txt"/>
>   </xdoclet>
>
> </goal>
>
> But this generates this exception...
>
> dummy-jelly:
> [xdoclet] [XDOCLET INFO]: Generating {0}.txt...
> [xdoclet] [XDOCLET INFO]: Generating
>
C:\eclipse\workspace\xdoclet2\target\tmp\xdoclet\sdk\xtag\testtag\DemoTag.tx
> t
> java.lang.NullPointerException
> at java.io.File.<init>(File.java:220)
> at
> xdoclet.util.ClasspathManager.getResource(ClasspathManager.java:143)
> at xdoclet.plugins.JellyPlugin.generate(JellyPlugin.java:40)
> at
> xdoclet.plugins.ScriptPlugin.generateOneFileForEach(ScriptPlugin.java:57)
> at xdoclet.Plugin.execute(Plugin.java:203)
> at xdoclet.XDoclet.execute(XDoclet.java:153)
>
>
> So its close. I guess I'm just missing something. One I get that figured
out
> there'll be no looking back for me :)
>
> James
> -------
> http://radio.weblogs.com/0112098/



-------------------------------------------------------
This SF.net email is sponsored by: Etnus, makers of TotalView, The debugger 
for complex code. Debugging C/C++ programs can leave you feeling lost and 
disoriented. TotalView can help you find your way. Available on major UNIX 
and Linux platforms. Try it free. www.etnus.com
_______________________________________________
xdoclet-user mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xdoclet-user

Reply via email to