How is the template associated with the plugin?

Richard Hoberman <[email protected]> Thu, 16 Oct 2008 14:17:04 +0100
Newsgroups gmane.comp.java.xdoclet-plugins
Message-ID <[email protected]>
Hi

I'm a complete xdoclet2 newbie.  I'm trying to write a plugin (source
below) to generate data objects using the InterfaceExtractor plugin as
an example.  I'm using 2.0.6 and running the plugin as an Ant task.  I
get the following error:

org.generama.GeneramaException: Exception occurred when running Velocity

I suspect that the problem is that my template is not being passed to
velocity (since there is nothing in the template that could break - it
is currently completely static - see below).  It is probably staring me
in the face, but where is the template for a plugin specified?  At the
moment I simply have a template with the same name as my plugin but with
the .vm extension which is sitting in the same directory as my plugin class.

If this isn't the problem, is there a way to get more information out of
Generama and/or Velocity as to just what the problem is?

Best regards

Richard Hoberman

----------------------
The plugin code:
----------------------

package example.xdoclet2.plugin;

import org.generama.QDoxCapableMetadataProvider;
import org.generama.VelocityTemplateEngine;
import org.generama.WriterMapper;
import org.generama.defaults.JavaGeneratingPlugin;

public class TestPlugin extends JavaGeneratingPlugin {

    public TestPlugin(VelocityTemplateEngine templateEngine,
                                QDoxCapableMetadataProvider
metadataProvider,
                                WriterMapper writerMapper) {

        super(templateEngine, metadataProvider, writerMapper);

    }

}

-----------------------------
The Velocity template
-----------------------------

public interface I {


}

-----------------
The Ant task
-----------------

<taskdef name="xdoclet2"
                classname="org.xdoclet.ant.XDocletTask"
                classpathref="classpath.tools.xdoclet2-plugins" />
   
   
    <target name="generate-representations" depends="prepare,
compile-tools">
       
        <xdoclet2 verbose="true">
           
            <fileset dir="${src.representations}">
                <include name="**/*.java" />
            </fileset>

            <component
                classname="org.generama.VelocityTemplateEngine" />
                                   
            <component
               
classname="com.cerbex.tools.xdoclet2.plugin.RepresentationPlugin"
                destdir="${gen.representations}" />
           
        </xdoclet2>
       
    </target>

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/