build.xml生成hibernate映射+bibernate.cfg.xml实例

 
<?xml version="1.0" encoding="GBK"?>
<project name="OA系统构建脚本" default="生成Hibernate配置文件" basedir=".">

   	<property name="src.dir" value="${basedir}/src"/>
	<property name="xdoclet.home" value="D:/share/11_oa/soft/xdoclet-plugins-1.0.3"/>

   	<!-- Build classpath -->
   	<path id="xdoclet.task.classpath">
      	<fileset dir="${xdoclet.home}/lib">
         	<include name="**/*.jar"/>
      	</fileset>
      	<fileset dir="${xdoclet.home}/plugins">
         	<include name="**/*.jar"/>
      	</fileset>
   	</path>
	<taskdef  
		name="xdoclet"
		classname="org.xdoclet.ant.XDocletTask"
		classpathref="xdoclet.task.classpath"
	/>
	
	<target name="生成Hibernate配置文件">
		<xdoclet>
			<fileset dir="${src.dir}/com/bjsxt/oa/model">
				<include name="**/*.java"/>
			</fileset>			
			<component
				classname="org.xdoclet.plugin.hibernate.HibernateConfigPlugin"
				destdir="${src.dir}"
				version="3.0"
				hbm2ddlauto="update"
				jdbcurl="jdbc:mysql://127.0.0.1/oa"
				jdbcdriver="com.mysql.jdbc.Driver"
				jdbcusername="root"
				jdbcpassword="root"
				dialect="org.hibernate.dialect.MySQLDialect"
				showsql="true"
			/>
		</xdoclet>
	</target>
	<target name="生成hibernate映射文件">
		<xdoclet>
			<fileset dir="${src.dir}/com/bjsxt/oa/model">
				<include name="**/*.java"/>
			</fileset>
			<component 
				classname="org.xdoclet.plugin.hibernate.HibernateMappingPlugin"
				version="3.0"
				destdir="${src.dir}"
			/>
		</xdoclet>
	</target>
</project>

你可能感兴趣的:(build.xml生成hibernate映射+bibernate.cfg.xml实例)