ant中build.xml为什么生不出.hbm.xml映射文件
2009-12-18 21:11:50 来源:WEB开发网核心提示:build.xml<?xml version="1.0" encoding="GBK"?><PRoject name="OA系统构建脚本" default="生成Hibernate配置文件" basedir=".
build.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="E:/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/oa01"
jdbcdriver="com.mysql.jdbc.Driver"
jdbcusername="root"
jdbcpassWord=""
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>
User.class
package com.bjsxt.oa.model;
public class User {
private Integer id;
private String username;
private String password;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
可以生出配置文件hibernate.cfg.xml,为什么不能生出映射文件User.hbm.xml?
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/tianguangrui/archive/2009/12/18/5028928.aspx
<?xml version="1.0" encoding="GBK"?>
<PRoject name="OA系统构建脚本" default="生成Hibernate配置文件" basedir=".">
<property name="src.dir" value="${basedir}/src"/>
<property name="xdoclet.home" value="E:/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/oa01"
jdbcdriver="com.mysql.jdbc.Driver"
jdbcusername="root"
jdbcpassWord=""
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>
User.class
package com.bjsxt.oa.model;
public class User {
private Integer id;
private String username;
private String password;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
}
可以生出配置文件hibernate.cfg.xml,为什么不能生出映射文件User.hbm.xml?
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/tianguangrui/archive/2009/12/18/5028928.aspx
赞助商链接