build-blank.xml
第一个项目都要写 build.xml 一些基本的东西先写好
<?
xml version="1.0" encoding="UTF-8"
?>
< project name ="jsp-svn" default ="init" >
< property file ="build.properties" />
< property name ="src.java.dir" value ="src" />
< property name ="src.test.dir" value ="test" />
< property name ="build.java.dir" value ="build/classes/java" />
< property name ="build.test.dir" value ="build/classes/test" />
< property name ="build.classes.dir" value ="build/classes" />
< property name ="test.docxml.dir" value ="doc/test/xml" />
< property name ="test.reports.dir" value ="doc/test/reports" />
< property name ="web.root" value ="WebContent" />
<!-- 定义类路径 -->
< path id ="project.classpath" >
< fileset dir ="${web.root}/WEB-INF/lib" >
< include name ="*.jar" />
</ fileset >
< pathelement location ="${build.java.dir}" />
< pathelement location ="${build.test.dir}" />
< pathelement location ="${junit.jar}" />
</ path >
< target name ="init" >
< mkdir dir ="${build.java.dir}" />
< mkdir dir ="${build.test.dir}" />
</ target >
< target name ="compile.java" depends ="init" >
< mkdir dir ="${build.java.dir}" />
< javac destdir ="${build.java.dir}" >
< src path ="${src.java.dir}" />
< classpath refid ="project.classpath" >
</ classpath >
</ javac >
</ target >
< target name ="compile.test" depends ="compile.java" >
< mkdir dir ="${build.test.dir}" />
< javac destdir ="${build.test.dir}" >
< src path ="${src.test.dir}" />
< classpath refid ="project.classpath" />
</ javac >
</ target >
< target name ="compile" depends ="compile.java,compile.test" >
</ target >
< target name ="build.java" depends ="compile.java" >
< copy todir ="${build.java.dir}" preservelastmodified ="true" >
< fileset dir ="${src.java.dir}" >
< include name ="**/*.*" />
< exclude name ="**/*.java" />
</ fileset >
</ copy >
</ target >
< target name ="build.test" depends ="compile.test" >
</ target >
< target name ="build" depends ="build.java,build.test" />
< target name ="deploy" depends ="build.java" >
</ target >
< target name ="test" depends ="build" >
< mkdir dir ="${test.docxml.dir}" />
< mkdir dir ="${test.reports.dir}" />
< junit haltonfailure ="yes" fork ="yes" >
< formatter type ="plain" usefile ="false" />
< formatter type ="xml" />
< test name ="example.ExampleTest" todir ="${test.docxml.dir}" >
</ test >
< classpath refid ="project.classpath" />
</ junit >
< junitreport todir ="${test.docxml.dir}" >
< fileset dir ="${test.docxml.dir}" >
< include name ="TEST-*.xml" />
</ fileset >
< report format ="frames" todir ="${test.reports.dir}" />
</ junitreport >
</ target >
< target name ="schema" depends ="build.java" >
< taskdef name ="schemaexport" classname ="org.hibernate.tool.hbm2ddl.SchemaExportTask" >
< classpath refid ="project.classpath" />
</ taskdef >
< schemaexport config ="${build.java.dir}/hibernate.cfg.xml"
quiet ="no" text ="true" drop ="no" delimiter =";"
output ="${build.classes.dir}/${project.name}_db.sql" />
</ target >
< target name ="clean" >
< delete includeEmptyDirs ="true" >
< fileset dir ="${build.classes.dir}" >
< include name ="**/*.class" />
</ fileset >
</ delete >
</ target >
</ project >
< project name ="jsp-svn" default ="init" >
< property file ="build.properties" />
< property name ="src.java.dir" value ="src" />
< property name ="src.test.dir" value ="test" />
< property name ="build.java.dir" value ="build/classes/java" />
< property name ="build.test.dir" value ="build/classes/test" />
< property name ="build.classes.dir" value ="build/classes" />
< property name ="test.docxml.dir" value ="doc/test/xml" />
< property name ="test.reports.dir" value ="doc/test/reports" />
< property name ="web.root" value ="WebContent" />
<!-- 定义类路径 -->
< path id ="project.classpath" >
< fileset dir ="${web.root}/WEB-INF/lib" >
< include name ="*.jar" />
</ fileset >
< pathelement location ="${build.java.dir}" />
< pathelement location ="${build.test.dir}" />
< pathelement location ="${junit.jar}" />
</ path >
< target name ="init" >
< mkdir dir ="${build.java.dir}" />
< mkdir dir ="${build.test.dir}" />
</ target >
< target name ="compile.java" depends ="init" >
< mkdir dir ="${build.java.dir}" />
< javac destdir ="${build.java.dir}" >
< src path ="${src.java.dir}" />
< classpath refid ="project.classpath" >
</ classpath >
</ javac >
</ target >
< target name ="compile.test" depends ="compile.java" >
< mkdir dir ="${build.test.dir}" />
< javac destdir ="${build.test.dir}" >
< src path ="${src.test.dir}" />
< classpath refid ="project.classpath" />
</ javac >
</ target >
< target name ="compile" depends ="compile.java,compile.test" >
</ target >
< target name ="build.java" depends ="compile.java" >
< copy todir ="${build.java.dir}" preservelastmodified ="true" >
< fileset dir ="${src.java.dir}" >
< include name ="**/*.*" />
< exclude name ="**/*.java" />
</ fileset >
</ copy >
</ target >
< target name ="build.test" depends ="compile.test" >
</ target >
< target name ="build" depends ="build.java,build.test" />
< target name ="deploy" depends ="build.java" >
</ target >
< target name ="test" depends ="build" >
< mkdir dir ="${test.docxml.dir}" />
< mkdir dir ="${test.reports.dir}" />
< junit haltonfailure ="yes" fork ="yes" >
< formatter type ="plain" usefile ="false" />
< formatter type ="xml" />
< test name ="example.ExampleTest" todir ="${test.docxml.dir}" >
</ test >
< classpath refid ="project.classpath" />
</ junit >
< junitreport todir ="${test.docxml.dir}" >
< fileset dir ="${test.docxml.dir}" >
< include name ="TEST-*.xml" />
</ fileset >
< report format ="frames" todir ="${test.reports.dir}" />
</ junitreport >
</ target >
< target name ="schema" depends ="build.java" >
< taskdef name ="schemaexport" classname ="org.hibernate.tool.hbm2ddl.SchemaExportTask" >
< classpath refid ="project.classpath" />
</ taskdef >
< schemaexport config ="${build.java.dir}/hibernate.cfg.xml"
quiet ="no" text ="true" drop ="no" delimiter =";"
output ="${build.classes.dir}/${project.name}_db.sql" />
</ target >
< target name ="clean" >
< delete includeEmptyDirs ="true" >
< fileset dir ="${build.classes.dir}" >
< include name ="**/*.class" />
</ fileset >
</ delete >
</ target >
</ project >
build.properties
junit.jar
=
${eclipse.home}/plugins/org.junit_3
.8.1
/junit.jar