0

我正在尝试为 Envers 合并休眠模式生成器。我添加了这个目标:

    <target name="schemaexport"
        description="Exports a generated schema to DB and file">
    <path id="hibernate.classpath">
        <pathelement path="./lib/hibernate-persistence/*.jar" />
    </path>
    <taskdef name="hibernatetool"
             classname="org.hibernate.tool.ant.EnversHibernateToolTask"
             classpathref="hibernate.classpath"/>

    <hibernatetool destdir=".">
        <classpath>
            <fileset refid="lib.hibernate" />
            <path location="${build.demo.dir}" />
            <path location="${build.main.dir}" />
        </classpath>
        <jpaconfiguration persistenceunit="AuroraServicePU" />
        <hbm2ddl
          drop="false"
          create="true"
          export="false"
          outputfilename="versioning-ddl.sql"
          delimiter=";"
          format="true"/>
    </hibernatetool>
</target>

问题是我 使用类加载器 AntClassLoader[myproject\lib\hibernate-persistence*.jar] 得到错误 taskdef class org.hibernate.tool.ant.EnversHibernateToolTask

帮助会很大。

谢谢你,伊多。

4

1 回答 1

0

我怀疑你的路径不正确。我不相信你可以在 a 中使用通配符pathelement

尝试将您的更改path为:

<path id="hibernate.classpath">
    <fileset dir="lib">
        <include name="**/*.jar"/>
    </fileset>
</path>

如果失败,请使用-v标记运行 ant 并检查调试以获取更多提示。

于 2012-01-03T01:11:52.047 回答