You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Dimitris Mouchritsas <dm...@gmail.com> on 2007/11/20 11:35:03 UTC
help with uptodate and hibernate doclet
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, User.java, Account.java,
Login.java
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="${domain.build.dir}" />
<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
--
Dimitris Mouchritsas
Computer Services
Re: help with uptodate and hibernate doclet
Posted by David Weintraub <qa...@gmail.com>.
The problem with uptodate is that it can only have a single "target"
file to check against. Look at the AntContrib's <outofdate> task.
The <outofdate> task can take more than a single target, and (as an
added bonus), it can define the tasks to run if an outofdate condition
is detected. No more setting a property then having a task check that
property before it executes. Unless, you want to do that. The
<outofdate> task can also set a property if an <outofdate> condition
is detected.
See <http://ant-contrib.sourceforge.net/tasks/tasks/outofdate.html>.
On Nov 20, 2007 5:35 AM, Dimitris Mouchritsas <dm...@gmail.com> 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, User.java, Account.java,
> Login.java
> 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="${domain.build.dir}" />
> <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
>
> --
> Dimitris Mouchritsas
> Computer Services
>
--
--
David Weintraub
qazwart@gmail.com
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org
Re: help with uptodate and hibernate doclet
Posted by Steve Loughran <st...@apache.org>.
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, User.java, Account.java,
> Login.java
> 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="${domain.build.dir}" />
> <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 http://www.1060.org/blogxter/publish/5
Author: Ant in Action http://antbook.org/
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org