On Thu, 2004-12-09 at 13:26, Vidya Vadke wrote: > I need to generate one xml file which is subset of hbm.xml files > getting generated. > > My ant task looks like this: > > <target name="Hbm"> > <mkdir dir="${dist.dir}/Hibernate"/> > <taskdef name="hibernatedoclet" > classname="xdoclet.modules.hibernate.HibernateDocletTask" > classpathref="ejbdoclet.classpath"> > </taskdef> > > <hibernatedoclet > destdir="${hibernate.hbm}" verbose="true"> > <fileset dir="${source.dir}/main"> > <include name="**/hibernateobject/*.java"/> > </fileset> > <hibernate version="2.0"/> > <xmlTemplate templateFile="hibernate.xdt" destinationFile="out.xml"/> > </hibernatedoclet> > > This target works fine when I remove <xmlTemplate > templateFile="hibernate.xdt" destinationFile="out.xml"/> > from it.
The hibernate subtask's default pattern for generated files is "{0}.hbm.xml" - the {0} signifies it's using per-class generation. Because your destinationFile doesn't contain the {0} placeholder, it will assume it's generating a single file from all the classes in your fileset, and will expect the template to contain a forAllClasses loop or similar (even if there only happens to be one file in your fileset). So when the xmlTemplate subtask runs your copy of the hibernate.xdt template, there won't be a "current" class selected like there is for the usual subtask. Try setting the destinationFile to "{0}.out.xml" and see if that behaves any better. Andrew. > > i am using same hibernate.xdt which gets used by hibernate itself (for > testing purpose so that task doesnt fail due to error in xdt file.) > But when this entry it there, it gives me error: > [hibernatedoclet] Dec 9, 2004 6:25:32 PM xdoclet.XDocletMain start > [hibernatedoclet] INFO: Running <template/> > [hibernatedoclet] Dec 9, 2004 6:25:32 PM xdoclet.TemplateSubTask engineStarted > [hibernatedoclet] INFO: Generating output 'out.xml' using template > file 'file:hibernate.xdt'. > [hibernatedoclet] Dec 9, 2004 6:25:32 PM xdoclet.XDocletMain start > [hibernatedoclet] SEVERE: Running XDoclet failed. > [hibernatedoclet] Dec 9, 2004 6:25:32 PM xdoclet.XDocletMain start > [hibernatedoclet] SEVERE: <<currentClass == null!!!>> > [hibernatedoclet] build.xml:153: XDoclet failed. > [hibernatedoclet] at xdoclet.DocletTask.start(DocletTask.java:471) > [hibernatedoclet] at xjavadoc.ant.XJavadocTask.execute(XJavadocTask.java:105) > [hibernatedoclet] at > org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:269) > [hibernatedoclet] at org.apache.tools.ant.Task.perform(Task.java:364) > [hibernatedoclet] at org.apache.tools.ant.Target.execute(Target.java:301) > [hibernatedoclet] at org.apache.tools.ant.Target.performTasks(Target.java:328) > [hibernatedoclet] at > org.apache.tools.ant.Project.executeTarget(Project.java:1215) > [hibernatedoclet] at > org.apache.tools.ant.Project.executeTargets(Project.java:1063) > [hibernatedoclet] at > org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.run(InternalAntRunner.java:377) > [hibernatedoclet] at > org.eclipse.ant.internal.ui.antsupport.InternalAntRunner.main(InternalAntRunner.java:135) > [hibernatedoclet] Caused by: xdoclet.XDocletException: currentClass == null!!! -- ------------------------------------------------------- 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://productguide.itmanagersjournal.com/ _______________________________________________ xdoclet-user mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/xdoclet-user