ANT build.dtd
Eclipse 配置自动提示:
首选项 -> XML -> XML(XML Catalog|User Spec Entries|Add) ... build.dtd
注意:
当我们使用一些扩展的Task时, 必须在DTD中增加相应该的DTD定义.
示例 schemaexport:
则应该在build.dtd文件结尾增加DTD定义:
并且在实体中增加:
附件为build.dtd:
Eclipse 配置自动提示:
首选项 -> XML -> XML(XML Catalog|User Spec Entries|Add) ... build.dtd
注意:
当我们使用一些扩展的Task时, 必须在DTD中增加相应该的DTD定义.
示例 schemaexport:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE project SYSTEM "build.dtd">
<project name="debug" default="schemaexport" basedir=".">
<property name="src.dir" value="src" />
<property name="classes.dir" value="build/classes" />
<property name="lib.dir" value="WebContent/WEB-INF/lib" />
<property name="jar.output" value="jar" />
<property name="doc.output" value="api"/>
<path id="project.classpath">
<fileset dir="WebContent/WEB-INF/lib">
<include name="**/*.jar" />
</fileset>
</path>
<!-- 输出DTD文档 -->
<target name="dtd">
<antstructure output="build.dtd" />
</target>
<!-- 初始化任务 -->
<target name="init">
</target>
<!-- 编译 -->
<target name="compile" depends="init" description="compile the source files">
<mkdir dir="${classes.dir}"/>
<javac srcdir="${src.dir}" destdir="${classes.dir}" target="1.5">
<classpath refid="project.classpath"/>
</javac>
</target>
<!-- 打包成jar -->
<target name="pack" description="make .jar file">
<mkdir dir="${jar.output}" />
<jar destfile="${jar.output}/${project.name}.jar" basedir="${classes.dir}">
<exclude name="**/*Test.*" />
<exclude name="**/Test*.*" />
</jar>
</target>
<!-- 输出api文档 -->
<target name="doc" description="create api doc">
<mkdir dir="${doc.output}" />
<javadoc destdir="${doc.output}" author="true" version="true" use="true" windowtitle="Java Doc API">
<packageset dir="${src.dir}" defaultexcludes="yes">
<include name="cn/**" />
</packageset>
</javadoc>
</target>
<target name="schemavalidate">
<taskdef name="schemavalidator" classname="org.hibernate.tool.hbm2ddl.SchemaValidatorTask" classpathref="project.classpath" />
<schemavalidator properties="res\hibernate.properties">
<fileset dir="src">
<include name="**/*.hbm.xml" />
</fileset>
</schemavalidator>
</target>
<target name="schemaexport" depends="schemavalidate">
<taskdef name="schemaexport" classname="org.hibernate.tool.hbm2ddl.SchemaExportTask" classpathref="project.classpath" />
<schemaexport properties="res\hibernate.properties" quiet="no" text="no" drop="no" delimiter=";" output="schema-export.sql">
<fileset dir="src">
<include name="**/*.hbm.xml" />
</fileset>
</schemaexport>
</target>
</project>
则应该在build.dtd文件结尾增加DTD定义:
<!ELEMENT schemavalidator (%tasks;|%types;)*>
<!ATTLIST schemavalidator
properties CDATA #REQUIRED>
<!ELEMENT schemaexport (%tasks;|%types;)*>
<!ATTLIST schemaexport
properties CDATA #REQUIRED
quiet %boolean; #IMPLIED
text %boolean; #IMPLIED
drop %boolean; #IMPLIED
delimiter CDATA #IMPLIED
output CDATA #IMPLIED>
并且在实体中增加:
<!ENTITY % tasks "schemavalidator|schemaexport|propertyfile|...">
附件为build.dtd: