我正在尝试使用 ANT 从我的 Hibernate 注释 bean 生成 SQL DDL,根据我创建了以下 Ant 脚本的休眠工具文档:
<?xml version="1.0" encoding="UTF-8"?>
<project name="yourmarketnet" default="all" basedir=".">
<property name="build.dir" value="C:/Users/naim/Documents/NetBeansProjects/yourmarketnet/build" />
<target name="ddl_generation">
<!-- paths to required jars -->
<path location="web/WEB-INF/lib/hibernate-annotations.jar" />
<path location="web/WEB-INF/lib/ejb3-persistence.jar" />
<path location="web/WEB-INF/lib/hibernate-entitymanager.jar" />
<path location="web/WEB-INF/lib/javaassist.jar" />
<path location="web/WEB-INF/lib/hibernate-tools.jar"/>
<path location="web/WEB-INF/lib/hibernate-entitymanager.jar" />
<path location="web/WEB-INF/lib/jboss-archive-browsing.jar" />
<path location="web/WEB-INF/lib/javaassist.jar" />
<taskdef name="hibernatetool" classname="org.hibernate.tool.ant.HibernateToolTask">
</taskdef>
<classpath>
<!-- path of annotation beans -->
<path location="${build.dir}/web/WEB-INF/classes/com/yourmarketnet/beans" />
</classpath>
<!-- output destination -->
<hibernatetool destdir="${build.dir}">
<!-- were the annotation beans files are located-->
<!-- list exporters here -->
<hbm2ddl
export="false"
update="false"
drop="true"
create="true"
outputfilename="myApps.ddl"
delimiter=";"
format="false"
haltonerror="true"/>
</hibernatetool>
</target>
</project>
但是我收到以下错误:
使用类加载器 AntClassLoader[] 找不到 taskdef 类 org.hibernate.tool.ant.HibernateToolTask
我检查了我的 /lib & 文件夹,并且存在类路径 hibernate-tools。