<?xml version="1.0" encoding="UTF-8"?>
<project name="springapp" basedir="." default="compile">
<property environment="SystemVariable" />
<property file="build.properties" />
<path id="master-classpath">
<fileset dir="${web.dir}/WEB-INF/lib">
<include name="*.jar" />
</fileset>
<fileset dir="${server.lib}">
<include name="servlet*.jar" />
</fileset>
<pathelement path="${build.dir}" />
</path>
<target name="create.build.dir">
<mkdir dir="${build.dir}" />
</target>
<target name="remove.build.dir">
<delete includeemptydirs="true">
<fileset dir="${build.dir}" />
</delete>
</target>
<target name="compile" depends="">
<javac destdir="${build.dir}" encoding="UTF-8" debug="true" deprecation="true" optimize="true" failοnerrοr="true">
<src path="${src.dir}" />
<classpath refid="master-classpath" />
</javac>
</target>
<target name="build">
<jar destfile="WEB-INF/lib/custom-lib.jar" basedir="${build.dir}">
<manifest>
<attribute name="Build-By" value="${author}" />
</manifest>
</jar>
</target>
<target name="deploy" depends="build" description="Deploy application">
<copy todir="${deploy.path}/${name}" preservelastmodified="true">
<fileset dir="${web.dir}">
<include name="**/*.*" />
</fileset>
</copy>
</target>
<target name="deploywar" depends="build,delete.war.file" description="Deploy application as a WAR file">
<war destfile="${name}.war" webxml="${web.dir}/WEB-INF/web.xml">
<fileset dir="${web.dir}">
<include name="**/*.*" />
</fileset>
</war>
<copy todir="${deploy.path}" preservelastmodified="true">
<fileset dir=".">
<include name="*.war" />
</fileset>
</copy>
</target>
<target name="delete.war.file">
<echo message="delete deploy war file" />
<delete file="${deploy.path}/${name}.war" />
</target>
<target name="delete.war.dir">
<echo message="delete deploy dir" />
<delete dir="${deploy.path}/${name}" />
</target>
</project>
=======================================================================
author=taink
server.home=${SystemVariable.TOMCAT_HOME}
server.lib=${server.home}/lib
src.dir=src
web.dir=WebContent
build.dir=classes
projectname=mvc
deploy.path=${server.home}/webapps
=======================================================================
<?xml version="1.0" encoding="UTF-8"?>
<project name="springapp" basedir="." default="deploy">
<property environment="SystemVariable" />
<property file="build.properties" />
<property name="author" value="taink" />
<tstamp>
<format property="dstamp" pattern="MM-dd-yyyy HH:mm:ss" />
</tstamp>
<path id="master-classpath">
<fileset dir="${web.dir}/WEB-INF/lib">
<include name="*.jar" />
</fileset>
<fileset dir="${server.lib}">
<include name="servlet*.jar" />
</fileset>
<pathelement path="${build.dir}" />
</path>
<target name="compile" description="compile , compression jar file">
<javac destdir="../mvc-model/bin" srcdir="../mvc-model/src" debug="ture" encoding="UTF-8" />
<jar destfile="${web.dir}/WEB-INF/lib/mvc.jar" basedir="../mvc-model/bin">
<manifest>
<attribute name="Build-Date" value="${dstamp}" />
<attribute name="Build-By" value="${user.name}" />
</manifest>
</jar>
</target>
<target name="deploy" depends="compile,delete.war.file">
<war destfile="${projectname}.war" webxml="${web.dir}/WEB-INF/web.xml">
<fileset dir="${web.dir}">
<include name="**/*.*" />
</fileset>
</war>
<copy todir="${deploy.path}">
<fileset dir=".">
<include name="*.war" />
</fileset>
</copy>
</target>
<target name="delete.war.file">
<echo message="delete deploy war file" />
<delete file="${deploy.path}/${projectname}.war" />
</target>
<target name="delete.war.dir">
<echo message="delete deploy dir" />
<delete dir="${deploy.path}/${projectname}" />
</target>
</project>