TheServerSide is born again. No more Middleware Company preGoal/postGoal vs. depends=
Nov 24

Why it can be so frustrating getting things to work…

Tech Add comments

I just spent too long tweaking my build to use XDoclet with the Hibernate Doclet.

At first, I thought I would try the Maven plugin, which has you setup, what makes sense in the XML files into a scary set of properties:

# —————————————————————————–
# XDoclet Hibernate Doclet
# —————————————————————————–

maven.xdoclet.hibernatedoclet.destDir=${build.web.dir}
maven.xdoclet.hibernatedoclet.excludedTags=@version,@author,@todo
maven.xdoclet.hibernatedoclet.force=false
maven.xdoclet.hibernatedoclet.verbose=false

maven.xdoclet.hibernatedoclet.hibernate.0.Version=2.0
maven.xdoclet.hibernatedoclet.hibernate.0.validateXML=true

maven.xdoclet.hibernatedoclet.fileset.0=true
maven.xdoclet.hibernatedoclet.fileset.0.dir=${maven.src.dir}/java
maven.xdoclet.hibernatedoclet.fileset.0.include=foo/model/*.java

Then I could add:

<preGoal name=”java:compile”>
<attainGoal name=”xdoclet:hibernatedoclet”/>
</preGoal>

To get this right takes a few peeks into the plugin.jelly *just* to make sure. Anyway, after this was all setup, no Hibernate files were getting generated.

Lots of futzing around later (make sure the dirs were right etc) and I ended up taking a step back. I moved from the Maven plugin to just use the hibernatedoclet “manually” in the preGoal.

This also didn’t work.

I took the smart step back and setup a minimal build.xml which was JUST going to do the mapping.

I ran ant and got an error message saying that the WebDocletTask wasn’t found. Surely I read this wrong… it means HibernateDocletTask right?

I guess not. I grabbed the xdoclet web module and everything worked fine.

Gotta love not getting any error messages that make sense!