Hello,
I want to start using xdoclet with hibernate. I have written the build.xml file for ant and put the xdoclet tags in the source file. The build.xml file works without an exception but it does not generate the mapping file for hibernate. I suspect a really simple mistake but I do not see it. Please point me in the right direction.
Greetings Sven
build.xml: <?xml version="1.0" encoding="ISO-8859-1"?>
<project name="Messaging" default="build" basedir=".">
<property name="srcDir" location="WEB-INF/src"/> <property name="buildDir" location="WEB-INF/classes"/> <property name="libDir" location="WEB-INF/lib"/> <property name="xdocletDir" location="WEB-INF/lib/xdoclet"/> <property name="tomcatDir" location="../../common/lib"/>
<path id="class.path"> <fileset dir="${libDir}"> <include name="*.jar"/> </fileset> <fileset dir="${tomcatDir}"> <include name="*.jar"/> </fileset> </path>
<path id="class.path.xdoclet"> <fileset dir="${xdocletDir}"> <include name="*.jar"/> </fileset> <fileset dir="${libDir}"> <include name="commons-logging.jar"/> </fileset> </path>
<target name="init">
<taskdef name="xdoclet" classname="xdoclet.DocletTask" classpathref="class.path.xdoclet"/>
<taskdef name="hibernatedoclet" classname="xdoclet.modules.hibernate.HibernateDocletTask" classpathref="class.path.xdoclet"/>
</target>
<target name="compile" depends="init">
<javac srcdir="${srcDir}/messaging" destdir="${buildDir}" classpathref="class.path"/>
<javac srcdir="${srcDir}/persistence" destdir="${buildDir}" classpathref="class.path"/>
</target>
<target name="hibernate" depends="compile">
<hibernatedoclet destdir="${buildDir}/persistence"
excludedtags="@version,@author,@todo,@see"
addedtags="@xdoclet-generated at ${TODAY},@copyright The XDoclet Team,@author XDoclet,@version ${version}"
force="true"
verbose="true">
<fileset dir="${srcDir}/persistence"> <include name="*.java"/> </fileset>
<hibernate version="2.1"/> </hibernatedoclet> </target>
<target name="build" depends="hibernate">
<copy file="${srcDir}/messaging/application.properties" todir="${buildDir}/messaging"/>
</target>
<target name="clean"> <delete> <fileset dir="${buildDir}/persistence"> <include name="*"/> </fileset> <fileset dir="${buildDir}/messaging"> <include name="*"/> </fileset> </delete> </target>
</project>
User.java: package persistence;
/** * @hibernate.class * table="USER" */ public class User { private Long id; // identifier private String protocol; private String fromhost; private String tohost; private Integer port; private String mbox; private String user; private String passwd;
/** * @hibernate.property * column="FROMHOST" */ public String getFromhost() { return fromhost; }
public void setFromhost(String fromhost) { this.fromhost = fromhost; } /** * @hibernate.id * generator-class="native" * column="USER_ID" */ public Long getId() { return id; }
public void setId(Long id) { this.id = id; } /** * @hibernate.property * column="MBOX" */ public String getMbox() { return mbox; }
public void setMbox(String mbox) { this.mbox = mbox; } /** * @hibernate.property * column="PASSWD" */ public String getPasswd() { return passwd; }
public void setPasswd(String passwd) { this.passwd = passwd; } /** * @hibernate.property * column="PORT" */ public Integer getPort() { return port; }
public void setPort(Integer port) { this.port = port; } /** * @hibernate.property * column="PROTOCOL" */ public String getProtocol() { return protocol; }
public void setProtocol(String protocol) { this.protocol = protocol; } /** * @hibernate.property * column="TOHOST" */ public String getTohost() { return tohost; }
public void setTohost(String tohost) { this.tohost = tohost; } /** * @hibernate.property * column="USER" * unique="true" * not-null="true" */ public String getUser() { return user; }
public void setUser(String user) { this.user = user; } }
ant output:
Buildfile: /opt/tomcat5.0/webapps/Messaging/build.xml
init:
compile:
[javac] Compiling 6 source files to /opt/tomcat5.0/webapps/Messaging/WEB-INF/classes
[javac] Compiling 1 source file to /opt/tomcat5.0/webapps/Messaging/WEB-INF/classes
hibernate:
[hibernatedoclet] (XDocletMain.start 47 ) Running <hibernate/>
build:
BUILD SUCCESSFUL
Total time: 5 seconds
------------------------------------------------------- SF email is sponsored by - The IT Product Guide Read honest & candid reviews on hundreds of IT Products from real users. Discover which products truly live up to the hype. Start reading now. http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click _______________________________________________ xdoclet-user mailing list xdoclet-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/xdoclet-user