ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Steve Loughran <>
Subject Re: help with uptodate and hibernate doclet
Date Tue, 20 Nov 2007 15:31:09 GMT
Dimitris Mouchritsas wrote:
> Hi folks, I'm trying to create a condition task so as not to run a
> hibernatedoclet target.
> The problem is the target does not produce .hbm.xml files for all the
> classes. So
> for example if we have 3 classes in the src dir say,,,
> the resulting files in the build dir might look like:
> User.class
> User.hbm.xml
> Account.class
> Account.hbm.xml
> Login.class
> So not all classes have a hibernate configuration file. My problem is how
> can I use uptodate
> to check these? I've tried this:
> <uptodate>
>   <srcfiles dir="${src.dir}">
>     <include name="**/mypackage/domain/**/*.java" />
>   </srcfiles>
>   <chainedmapper>
>     <globmapper from="*" to="${}" />
>     <compositemapper>
>       <globmapper from="*.java" to="*.class" />
>       <globmapper from=".java" to="*.hbm.xml" />
>     </compositemapper>
>   </chainedmapper>
> </uptodate>
> But I guess this mapper needs every class to have a corresponding .hbm.xml

I could imagine a trick here. after running hibernate, you copy 
**/*.class to a separate location. Then, after compiling your source, 
you want compare the base *.java to the build/hibernate/**/*.class. this 
will trigger hibernate if any class has changed.

Some other options
  -restrict the include list to everything that generates a hibernate 
file. if they are all in one package, or all have a specific name, life 
is much easier.

-move to JPA annotations+hibernate. This works pretty well in the java5+ 
world; I prefer it to hibernate in many ways.

Steve Loughran        
Author: Ant in Action 

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message