[EMAIL PROTECTED] wrote:
I am trying to use the ojbdoclet example but I am getting the following error in ant:
build.xml:41: The <taskdef> task doesn't support the nested "ojbdoclet" element.
My build.xml:
<project default="repository-files">
<property name="dir.src" location="src"/> <property name="dir.lib" location="lib"/>
<property name="dir.java" location="${dir.src}/java"/>
<property name="dir.ojb" location="${dir.src}/metadata/ojb"/> <property name="dir.torque" location="${dir.src}/metadata/torque"/>
<property name="plugin.ojb" location="plugins/ojb"/>
<path id="classpath.project"> <fileset dir="${dir.lib}"> <include name="**/*.jar"/> </fileset> </path> <path id="classpath.ojbdoclet"> <path refid="classpath.project"/> <fileset dir="${plugin.ojb}/lib"> <include name="**/*.jar"/> </fileset> </path>
<target name="init">
<mkdir dir="${dir.ojb}"/> <mkdir dir="${dir.torque}"/>
</target>
<target name="repository-files" depends="init"> <!-- <java classname="xdoclet.modules.ojb.OjbDocletTask" classpathref="classpath.ojbdoclet"/>
This gives a java.lang.NoSuchMethodException: xdoclet.modules.ojb.OjbDocletTask.main([Ljava.lang.String;) therefore the classpath is correct. -->
<taskdef name="ojbdoclet" classname="xdoclet.modules.ojb.OjbDocletTask" classpathref="classpath.ojbdoclet" > <ojbdoclet destdir="${dir.ojb}"> <fileset dir="${dir.java}"/> <ojbrepository destinationFile="${dir.ojb}/repository_user.xml"/> <torqueschema databaseName="nortmais" destinationFile="${dir.torque}/project-schema.xml"/> </ojbdoclet> </taskdef>
</target>
</project>
Ant's taskdef task simply loads a task at runtime and declares an alias. As such, you don't nest the new task into the taskdef task. Change your build file like so:
<taskdef name="ojbdoclet"
classname="xdoclet.modules.ojb.OjbDocletTask"
classpathref="classpath.ojbdoclet" />
<ojbdoclet destdir="${dir.ojb}">
<fileset dir="${dir.java}" />
<ojbrepository destinationFile="${dir.ojb}/repository_user.xml" />
<torqueschema databaseName="nortmais"
destinationFile="${dir.torque}/project-schema.xml" />
</ojbdoclet>Tom
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
