build.xml 文件如下:
<?xml version="1.0" encoding="gbk"?>
<project name="OA系统构建脚本" default="生成Hibernate配置文件" basedir=".">
<project name="src.dir" value="${basedir}/src"/>
<project name="xdoclet.home" value="C:/xdoclet-plugins-dist-1.0.4"/><!-- build classpath -->
<path id="xdoclet.task.classpath">
<fileset dir="${xdoclet.home}/lib">
<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/oa/model">
<include name="**/*.java"/>
</fileset>
<component
classname="org.xdoclet.plugin.hibernate.HibernateConfigPlugin"
destdir="${src.dir}"
version="3.0"
jdbcurl="jdbc:mysql://localhost:3306/oa"
jdbcdriver="com.mysql.jdbc.Driver"
jdbcusername="root"
jdbcpassword="1"
dialect="org.hibernate.dialect.MySQLDialect"
showsql="true"
/>
</xdoclet>
</target>
<target name="生成hibernate映射文件">
<xdoclet>
<fileset dir="${src.dir}/com/oa/model">
<include name="**/*.java"/>
</fileset>
<component
classname="org.xdoclet.plugin.hibernate.HibernateMappingPlugin"
version="3.0"
hbm2ddlauto="update"
destdir="${src.dir}"
/>
</xdoclet>
</target>
</project>加载时出现如下内容:OA系统构建脚本<C:\Documents and Settings\hp\workspaxe\OA\${xdoclet.home}\lib not found.
build.xml运行时出现如下内容:Buildfile: C:\Documents and Settings\hp\workspace\OA\build.xmlBUILD FAILED
C:\Documents and Settings\hp\workspace\OA\build.xml:3: Problem: failed to create task or type project
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
Total time: 1 second
<?xml version="1.0" encoding="gbk"?>
<project name="OA系统构建脚本" default="生成Hibernate配置文件" basedir=".">
<project name="src.dir" value="${basedir}/src"/>
<project name="xdoclet.home" value="C:/xdoclet-plugins-dist-1.0.4"/><!-- build classpath -->
<path id="xdoclet.task.classpath">
<fileset dir="${xdoclet.home}/lib">
<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/oa/model">
<include name="**/*.java"/>
</fileset>
<component
classname="org.xdoclet.plugin.hibernate.HibernateConfigPlugin"
destdir="${src.dir}"
version="3.0"
jdbcurl="jdbc:mysql://localhost:3306/oa"
jdbcdriver="com.mysql.jdbc.Driver"
jdbcusername="root"
jdbcpassword="1"
dialect="org.hibernate.dialect.MySQLDialect"
showsql="true"
/>
</xdoclet>
</target>
<target name="生成hibernate映射文件">
<xdoclet>
<fileset dir="${src.dir}/com/oa/model">
<include name="**/*.java"/>
</fileset>
<component
classname="org.xdoclet.plugin.hibernate.HibernateMappingPlugin"
version="3.0"
hbm2ddlauto="update"
destdir="${src.dir}"
/>
</xdoclet>
</target>
</project>加载时出现如下内容:OA系统构建脚本<C:\Documents and Settings\hp\workspaxe\OA\${xdoclet.home}\lib not found.
build.xml运行时出现如下内容:Buildfile: C:\Documents and Settings\hp\workspace\OA\build.xmlBUILD FAILED
C:\Documents and Settings\hp\workspace\OA\build.xml:3: Problem: failed to create task or type project
Cause: The name is undefined.
Action: Check the spelling.
Action: Check that any custom tasks/types have been declared.
Action: Check that any <presetdef>/<macrodef> declarations have taken place.
Total time: 1 second
<project name="xdoclet.home" value="C:/xdoclet-plugins-dist-1.0.4"/>
这里面应该是property
<project name="src.dir" value="${basedir}/src"/>
<project name="xdoclet.home" value="C:/xdoclet-plugins-dist-1.0.4"/>
这两句的project标签换成property标签,再试试。