I ended using the solution that I proposed by adding an ant task that only compiles the classes needed to run hbm2java. The task is named "build-hibernate-dependencies", so I simply add a depends attribute to my hbm2java target for it:
<target name="hbm2java" depends="build-hibernate-dependencies">
<hibernatetool destdir="${src.dir}">
...
</hibernatetool>
</target>
The target "build-hibernate-dependencies" compiles the enums to the build directory:
<target name="build-hibernate-dependencies">
<mkdir dir="${build.dir}" />
<javac destdir="${build.dir}">
<src path="${src.dir}/enums" />
</javac>
</target>
And after that, I can now compile the entire project.