Hi!
I decided to move to xdoclet2, because old xdoclet templating
mechanism isn't enough. Anyway, I'm struggling with my first plugin
and I can't make it working.
For example I'd like to transform such tag in TreeCheckTest.java:
/**
* @tspec.description This class tests TreeCheck
*/
public class TreeCheckTest extends TestCase {}
into XML.
I wrote my plugin:
public class TspecDescriptionPlugin extends QDoxPlugin {
public TspecDescriptionPlugin (JellyTemplateEngine jelly,
QDoxCapableMetadataProvider qdox, WriterMapper writer)
throws ClassNotFoundException {
super(jelly, qdox, writer);
setFilereplace ("command-mapping.xml");
setMultioutput (false);
//new TagLibrary(qdox);
}
}
I have also TspecDescriptionPlugin.jelly file:
<j:jelly xmlns:j="jelly:core" xmlns:x="jelly:xml">
<x:comment text="${dontedit}" trim="true"/>
<commands>
<j:forEach var="class" items="${metadata}">
<j:if test="${plugin.shouldGenerate(class)}">
<command name="${plugin.getCommandName(class)}"
value="${class.fullyQualifiedName}"/>
</j:if>
</j:forEach>
</commands>
</j:jelly>
I know that you prefer maven, but ant is used by a company I work
for. Here is my build.xml:
<project name="xdoclet-sample" default="xdoclet">
<property name="xdoclet.lib.dir"
value="C:/Karol/xdoclet-plugins-1.0.3/lib/" />
<target name="xdoclet">
<mkdir dir="${basedir}/target/xdoclet/persistence"/>
<path id="xdoclet.task.classpath">
<fileset dir="${xdoclet.lib.dir}">
<include name="**/*.jar" />
</fileset>
</path>
<taskdef name="xdoclet" classname="org.xdoclet.ant.XDocletTask"
classpathref="xdoclet.task.classpath" />
<xdoclet>
<!-- defines the file handled by xdoclet2 -->
<fileset dir=".">
<include name="**/*.java" />
</fileset>
<!-- defines the processing of a plugin -->
<component classname="TspecDescriptionPlugin"
destdir="${basedir}" />
</xdoclet>
</target>
</project>
Now, I doesn't work, ant gives following error:
BUILD FAILED
C:\Karol\workspace\qdox_test\build.xml:11: Class Not Found:
Classloader URLs (classpath):
at
org.nanocontainer.ant.PicoContainerTask.execute(PicoContainerTask.java:104)
(...)
Caused by: java.lang.ClassNotFoundException: TspecDescriptionPlugin
at java.net.URLClassLoader$1.run(URLClassLoader.java:199)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at
org.nanocontainer.DefaultNanoContainer$URLPrintingClassLoader.findClass(DefaultNanoContainer.java:167)
So I guess the TspecDescriptionPlugin plugin is a problem, but I
can't figure out what is wrong. It's in default package, so it seems
ok to me?
I guess I missed something out, but I must admit that the whole
xdoclet2 concept is overwhelming me. I can understand what each part
is responsible for, but as a whole, I'm lost in it.
Any help is appreciated, thanks,
Karol
--
Wysokie Obroty Magazyn - nowy miesiecznik motoryzacyjny. Pierwszy numer juz w
sprzedazy.
Wiecej informacji na: http://auto.gazeta.pl/auto/0,0.html