<project basedir="." default="deploy" name="****">
<property name="basePath" value="****" />
<property name="destPath" value="${basePath}\svn" />
<property name="svnurl" value="****" />
<property name="svn.username" value="****" />
<property name="svn.password" value="****" />
<property name="server" value="****" />
<property name="tomcat.path" value="****" />
<property name="ftp.username" value="****" />
<property name="ftp.password" value="****" />
<property name="telnet.username" value="****" />
<property name="telnet.password" value="****" />
<property name="telnet.prompt" value="$" />
<path id="ywtcclibpath">
<fileset dir="${destPath}/global-lib">
<include name="**\**.jar" />
</fileset>
</path>
<taskdef name="svn" classname="org.tigris.subversion.svnant.SvnTask" />
<target name="svncheckout" >
<echo message="svn checkout from ${svnurl}" />
<svn javahl="true" username="${svn.username}" password="${svn.password}">
<checkout url="${svnurl}/global-lib" destPath="${destPath}/global-lib" />
<checkout url="${svnurl}/****service" destPath="${destPath}/****service" />
<checkout url="${svnurl}/****web" destPath="${destPath}/****web" />
</svn>
</target>
<target name="preparewar" depends="svncheckout">
<echo message="start to make a war" />
<delete dir="${basePath}\target\web" />
<mkdir dir="${basePath}\target\web" />
<copy todir="${basePath}\target\web">
<fileset dir="${destPath}\****web\web">
<include name="**/**/**" />
<exclude name="**/.svn/**" />
</fileset>
</copy>
<mkdir dir="${basePath}\target\web\WEB-INF\classes" />
<echo message="compile the service code" />
<javac fork="true" classpathref="ywtcclibpath" srcdir="${destPath}\****service\src\main\java" encoding="UTF-8"
destdir="${basePath}\target\web\WEB-INF\classes" target="1.5" memorymaximumsize="256m" excludes="**/.svn/**" />
<copy todir="${basePath}\target\web\WEB-INF\classes">
<fileset dir="${destPath}\****service\src\main\resource" />
</copy>
<!--
<echo message="compile the service junit code" />
<javac fork="true" classpathref="ywtcclibpath" srcdir="${destPath}\****service\src\test\java" encoding="UTF-8" destdir="${destPath}\target\web\WEB-INF\classes" target="1.5" memorymaximumsize="256m" excludes="**/.svn/**" />
<junit showoutput="true" printsummary="true" fork="true">
<classpath>
<path>
<fileset dir="${destPath}/target/lib">
<include name="**\**.jar" />
</fileset>
</path>
<path location="${destPath}\target\web\WEB-INF\classes" />
</classpath>
<formatter type="plain" />
<batchtest haltοnerrοr="on" haltonfailure="on" todir="${destPath}\target">
<fileset dir="${destPath}\target\web\WEB-INF\classes">
<include name="**\*Test.class" />
</fileset>
</batchtest>
</junit>
-->
<echo message="compile the web code" />
<javac fork="true" classpathref="ywtcclibpath" srcdir="${destPath}\****web\src\main\java" encoding="UTF-8" destdir="${basePath}\target\web\WEB-INF\classes" target="1.5" memorymaximumsize="256m" excludes="**/.svn/**" />
<copy todir="${basePath}\target\web\WEB-INF\classes">
<fileset dir="${destPath}\****web\src\main\resource" />
</copy>
<copy todir="${basePath}\target\web\WEB-INF\lib">
<fileset dir="${basePath}\target\lib" />
</copy>
<war destfile="${basePath}\ROOT.war" basedir="${basePath}\target\web" />
</target>
<target name="shutdownAndUpload" depends="preparewar">
<echo message="cleaning remote server files" />
<telnet server="${server}">
<read>login:</read>
<write string="${telnet.username}" />
<read>Password:</read>
<write string="${telnet.password}" />
<read string="${telnet.prompt}" />
<write>${tomcat.path}/bin/shutdown.sh</write>
<read string="${telnet.prompt}" />
</telnet>
<telnet server="${server}">
<read>login:</read>
<write string="${telnet.username}" />
<read>Password:</read>
<write string="${telnet.password}" />
<read string="${telnet.prompt}" />
<write>rm -R ${tomcat.path}/webapps/ROOT</write>
<read string="${telnet.prompt}" />
<write>rm -R ${tomcat.path}/webapps/ROOT.war</write>
<read string="${telnet.prompt}" />
</telnet>
<ftp password="${ftp.password}" server="${server}" userid="${ftp.username}" remotedir="${tomcat.path}/webapps/" binary="true">
<fileset file="${basePath}\ROOT.war" />
</ftp>
</target>
<target name="deploy" depends="shutdownAndUpload">
<telnet server="${server}">
<read>login:</read>
<write string="${telnet.username}" />
<read>Password:</read>
<write string="${telnet.password}" />
<read string="${telnet.prompt}" />
<write string="nohup ${tomcat.path}/bin/startup.sh" />
<read string="${telnet.prompt}" />
</telnet>
<echo message="well doen, it's over." />
</target>
</project>