Anyone using hbm2java in an ant task and *not* getting Log4j warning
messages? If so, can I see (the relevant parts) of your build.xml?
I used hbm2java in my build (the task works; source code created),
but for all I've tried, I cannot get Log4j connected. Just completed
an experiment starting from Hibernate's distribution files, adding a
simple hbm2java task to the given build.xml, changing as little as
possible, and I still get the same complaints from Log4j:
Code:
[hbm2java] Processing 1 files.
[hbm2java] Building hibernate objects
[hbm2java] log4j:WARN No appenders could be found for logger
(net.sf.hibernate.util.DTDEntityResolver).
[hbm2java] log4j:WARN Please initialize the log4j system properly.
This is with all Hibernate distribution files, in the structure given.
Adding only hibernate.jar and hibernate-tools.jar to /lib, and
defining classpath.project as (dir.lib = lib.dir, etc.):
Code:
<path id="classpath.project">
<fileset dir="${dir.lib}">
<include name="**/*.jar"/>
</fileset>
<pathelement path="${dir.bin}"/>
<pathelement path="${dir.src}"/>
<pathelement path="${dir.build}"/>
</path>
This is the new task:
Code:
<target name="codegen">
<taskdef name="hbm2java"
classname="net.sf.hibernate.tool.hbm2java.Hbm2JavaTask"
classpathref="classpath.project"/>
<hbm2java output="${dir.src}">
<classpath>
<pathelement path="${classpath.project}"/>
</classpath>
<fileset dir="${dir.src}">
<include name="**/*.hbm.xml"/>
</fileset>
</hbm2java>
</target>
The files are generated. Only the connect to Log4j fails.
I've been jammed on this one for several cycles. If you have hbm2java
working with Log4j, I'd really appreciate a look at your build.xml.
Versions: Hibernate: 2.1, Ant: 1.6.1, JVM: j2sdk-1.4.2.
Many thanks,
William BC Crandall
bc.crandall [around] earthlink.net