Member Menu
 
 Monthly JBoss newsletter:
 
Hibernate Books
CaveatEmptor

XDoclet2 for Hibernate3

Since this is brand new XDoclet version and also new Hibernate version, I think this deserves a new page.

First look at the old XDoclet for Hibernate [http://www.hibernate.org/72.html] page. The concept didn't change much (at least not for users).

Helpful links:

Here is mine final working Ant script:

<project name="xdoclet2-plugin" default="xdoclet2">

    <property name="xdoclet2.lib.dir" value="${user.home}/.maven/repository"/>

    <target name="xdoclet2">
        <mkdir dir="${basedir}/target/xdoclet2/persistence"/>
        <path id="xdoclet2.task.classpath">
            <!-- xdoclet2 -->
            <pathelement location="${xdoclet2.lib.dir}/xdoclet/jars/xdoclet-SNAPSHOT.jar"/>
            <!-- Add the xdoclet2 plugins jar here -->
            <pathelement location="${xdoclet2.lib.dir}/xdoclet-plugins/jars/xdoclet-plugin-hibernate-1.0.jar"/>
            <!-- xdoclet2 runtime dependencies -->
            <pathelement location="${xdoclet2.lib.dir}/generama/jars/generama-1.1.jar"/>
            <pathelement location="${xdoclet2.lib.dir}/picocontainer/jars/picocontainer-1.0.jar"/>
            <pathelement location="${xdoclet2.lib.dir}/nanocontainer/jars/nanocontainer-1.0-beta-1.jar"/>
            <pathelement location="${xdoclet2.lib.dir}/nanocontainer/jars/nanocontainer-ant-1.0-beta-1.jar"/>
            <pathelement location="${xdoclet2.lib.dir}/qdox/jars/qdox-1.6-SNAPSHOT.jar"/>
            <pathelement location="${xdoclet2.lib.dir}/velocity/jars/velocity-1.4-dev.jar"/>
            <pathelement location="${xdoclet2.lib.dir}/commons-logging/jars/commons-logging-1.0.3.jar"/>
            <pathelement location="${xdoclet2.lib.dir}/commons-collections/jars/commons-collections-2.1.jar"/>
            <pathelement location="${xdoclet2.lib.dir}/commons-jelly/jars/commons-jelly-1.0-RC2-SNAPSHOT.jar"/>
            <pathelement location="${xdoclet2.lib.dir}/commons-jelly/jars/commons-jelly-20030902.160215.jar"/>
            <pathelement location="${xdoclet2.lib.dir}/commons-jelly/jars/commons-jelly-tags-define-1.0.jar"/>
            <pathelement location="${xdoclet2.lib.dir}/commons-jelly/jars/commons-jelly-tags-antlr-20030211.143720.jar"/>
            <pathelement location="${xdoclet2.lib.dir}/commons-jelly/jars/commons-jelly-tags-jsl-20030211.143151.jar"/>
            <pathelement location="${xdoclet2.lib.dir}/commons-jelly/jars/commons-jelly-tags-log-20030211.142821.jar"/>
            <pathelement location="${xdoclet2.lib.dir}/commons-jelly/jars/commons-jelly-tags-velocity-20030303.205659.jar"/>
            <pathelement location="${xdoclet2.lib.dir}/commons-jelly/jars/commons-jelly-tags-xml-20040613.030723.jar"/>
            <pathelement location="${xdoclet2.lib.dir}/log4j/jars/log4j-1.2.8.jar"/>
            <pathelement location="${xdoclet2.lib.dir}/commons-logging/jars/commons-logging-1.0.4.jar"/>
            <pathelement location="${xdoclet2.lib.dir}/dom4j/jars/dom4j-1.4-dev-8.jar"/>
            <pathelement location="${xdoclet2.lib.dir}/commons-beanutils/jars/commons-beanutils-1.6.1.jar"/>
            <pathelement location="${xdoclet2.lib.dir}/commons-jexl/jars/commons-jexl-1.0-beta-2.jar"/>
        </path>

        <taskdef
            name="xdoclet2"
            classname="org.xdoclet.ant.XDocletTask"
            classpathref="xdoclet2.task.classpath"
            />

    </target>

    <target name="remove" depends="xdoclet2" >
        <delete>
            <fileset dir="${basedir}/src">
                <include name="**/*.hbm.xml"/>
            </fileset>
        </delete>
    </target>
    
    <target name="hibernate" depends="remove">
        <xdoclet2>
            <!-- defines the file handled by xdoclet2 -->
            <fileset dir="${basedir}/src">
                <include name="**/*.java"/>
            </fileset>

            <!-- defines the processing of a plugin -->
            <component
                classname="org.xdoclet.plugin.hibernate.HibernateMappingPlugin"
                destdir="${basedir}/src"
                version="3.0"
                />
        </xdoclet2>
    </target>

</project>

Regarding dependency libraries. Pull the stuff down with Maven (that's how I did it, and it was my first time using Maven :-(, so it cannot be so hard :-). Follow this link for the missing jelly libs - http://jakarta.apache.org/commons/jelly/libs/.

For any other info, I think wassup (see Hibernate forum) is your man. :-)

Rgds, Ales


  NEW COMMENT

may... 14 Jun 2005, 04:37 peoples
i note that you include some jars more than once (commons-logging,
commons-jelly)... other than that, thanks for the instructions;
 
Tag migration 30 Oct 2005, 14:13 matthew.mceachen
This page isn't word-writable (and to be honest, I found it after I made
the new page), but http://www.hibernate.org/338.html#A5 talks about a
tag name change that the XDoclet 2 people did that tripped me up. We
should merge these two pages.
 
© Copyright 2006, Red Hat Middleware, LLC. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc. [Privacy Policy]