scm2的ant编译打包脚本

<?xmlversion="1.0"encoding="UTF-8"?>

<!--======================================================================

www.BSTEK.com

======================================================================-->

<projectname="DoradoProject"default="package">

<propertyfile="${basedir}/build.properties"/>

<propertyname="catalina.home"value="${catalina.home}"/>

<propertyname="lib.dir"value="${web.dir}/WEB-INF/lib"/>

<propertyname="cfg.dir"value="../src/com/hupun/scm/ibatis"/>

<!--<propertyname="build.compiler"value="org.eclipse.jdt.core.JDTCompilerAdapter"/>-->

<targetname="init"depends="clean">

<mkdirdir="${build.dir}"/>

<mkdirdir="${build.dir}/dorado-home"/>

<!--<copytodir="${build.dir}/dorado-home">

<filesetdir="../dorado-home">

<includename="**/*.*"/>

</fileset>

</copy>

-->

<!--<mkdirdir="${build.dir}/WebContent"/>-->

<copytodir="${build.dir}/WebContent">

<filesetdir="${web.dir}">

<includename="**/*.*"/>

</fileset>

</copy>

<!--

<deletefile="${build.dir}/WebContent/WEB-INF/dorado.properties"/>

<copyfile="prod-dorado.properties"tofile="${build.dir}/WebContent/WEB-INF/dorado.properties"/>

-->

</target>

<pathid="compile.classpath">

<filesetdir="${catalina.home}/lib">

<includename="*.jar"/>

</fileset>

<filesetdir="${lib.dir}">

<includename="*.jar"/>

</fileset>

</path>

<targetname="compile"description="CompileJavasources">

<mkdirdir="${build.dir}/WebContent/WEB-INF/classes"/>

<javacsource="1.6"target="1.6"fork="true"executable="C:\ProgramFiles\Java\jdk1.6.0_13\bin\javac"debug="true"srcdir="../src"

destdir="${build.dir}/WebContent/WEB-INF/classes"includeantruntime="on"encoding="UTF-8">

<classpathrefid="compile.classpath"/>

</javac>

<copytodir="${build.dir}/WebContent/WEB-INF/classes">

<filesetdir="../src">

<excludename="**/*.java"/>

<includename="**/*.xml"/>

<includename="**/*.ibatis"/>

<includename="**/*.properties"/>

<includename="**/*.js"/>

<includename="**/*.css"/>

</fileset>

<!--<filesetdir="${cfg.dir}"/>-->

</copy>

<copytodir="${build.dir}/WebContent/">

<filesetdir="../WebContent"></fileset>

</copy>

</target>

<!--==================================================================-->

<!--MakeDoradoWebProjectwarfile-->

<!--==================================================================-->

<targetname="war"depends="compile">

<wardestfile="${build.dir}/${final.name}.war"webxml="${build.dir}/WebContent/WEB-INF/web.xml">

<filesetdir="${build.dir}/WebContent/"/>

<!--<zipfilesetprefix="WEB-INF/classes/dorado-home"dir="${build.dir}/dorado-home"/>-->

</war>

</target>

<!--==================================================================-->

<!--CleanDoradobuildfile-->

<!--==================================================================-->

<targetname="clean">

<deletedir="${build.dir}"/>

</target>

<!--copywar-->

<targetname="copywar">

<deletedir="${catalina.home}/webapps/SCM"/>

<deletefile="${catalina.home}/webapps/SCM.war"/>

<copytodir="${catalina.home}/webapps/">

<filesetfile="${build.dir}/SCM.war"/>

</copy>

</target>

<targetname="package"depends="clean,init,compile,war,copywar">

</target>

</project>

注意点

A.打包包含资源文件

<filesetdir="../src">

<excludename="**/*.java"/>

<includename="**/*.xml"/>

<includename="**/*.ibatis"/>

<includename="**/*.properties"/>

<includename="**/*.js"/>

<includename="**/*.css"/>

</fileset>

B.编译带上debug="true"不关联源文件

<javacsource="1.6"target="1.6"fork="true"executable="C:\ProgramFiles\Java\jdk1.6.0_13\bin\javac"debug="true"

==========scm_auto_package.batstart==========

echo'killtomcat'

calltaskkill/IMjava.exe

echo'updatesql'

cdF:\SCM_SAAS\sql

rem#rm-rf/home/admin/scm/source/*

callsvn-q--forcecheckouthttps://localhost:5032/svn/xxx--username=xxx--password=xxx

callxcopy/S/YF:\SCM_SAAS\sql\设计文档F:\tools\SQLTool\sql

callF:\tools\SQLTool\runSQL.bat

rem#callsvnupdate

echo'dbupdateend'

callF:\SCM_SAAS\scm2_package.bat

cdF:\SCM_SAAS

callF:\apache-tomcat-7.0.16\bin\startup.bat

echo'updatesqlok'

===========scm_auto_package.batend==================

===========scm2_package.batend==================

echo'updatesource'

cdF:\SCM_SAAS\source

rem#rm-rf/home/admin/scm/source/*

callsvncheckouthttps://localhost:5032/svn/xxx--username=xxxx--password=xxxx

rem#callsvnupdate

cdF:\SCM_SAAS\source\SCM2.0\script

callantpackage

cdF:\SCM_SAAS

echo'updatesourceok'

===========scm2_package.batend==================

相关推荐