首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 嵌入开发 > 单片机 >

scm2的ant编译封装脚本

2012-09-06 
scm2的ant编译打包脚本?xml version1.0 encodingUTF-8?!--

scm2的ant编译打包脚本
<?xml version="1.0" encoding="UTF-8"?>
<!-- ======================================================================
     www.BSTEK.com                                                               
     ====================================================================== -->
<project name="DoradoProject" default="package">

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

<property name="catalina.home" value="${catalina.home}"/>
<property name="lib.dir"    value="${web.dir}/WEB-INF/lib"/>
<property name="cfg.dir" value="../src/com/hupun/scm/ibatis"/>
<!--<property name="build.compiler" value="org.eclipse.jdt.core.JDTCompilerAdapter"/>-->

<target name="init" depends="clean">
<mkdir dir="${build.dir}" />
<mkdir dir="${build.dir}/dorado-home" />
<!--<copy todir="${build.dir}/dorado-home">
<fileset dir="../dorado-home">
<include name="**/*.*" />
</fileset>
</copy>
-->
<!--<mkdir dir="${build.dir}/WebContent" />-->
<copy todir="${build.dir}/WebContent">
<fileset dir="${web.dir}">
<include name="**/*.*" />
</fileset>
</copy>
<!--
<delete file="${build.dir}/WebContent/WEB-INF/dorado.properties" />
<copy file="prod-dorado.properties" tofile="${build.dir}/WebContent/WEB-INF/dorado.properties" />
-->
</target>

<path id="compile.classpath"> 
        <fileset dir="${catalina.home}/lib"> 
          <include name="*.jar"/> 
        </fileset> 
        <fileset dir="${lib.dir}"> 
          <include name="*.jar"/> 
        </fileset> 
</path> 

<target name="compile" description="Compile Java sources" > 
        <mkdir dir="${build.dir}/WebContent/WEB-INF/classes"/> 
        <javac source="1.6" target="1.6" fork="true" executable="C:\Program Files\Java\jdk1.6.0_13\bin\javac" debug="true" srcdir="../src" 
              destdir="${build.dir}/WebContent/WEB-INF/classes"  includeantruntime="on" encoding="UTF-8"> 
            <classpath refid="compile.classpath"/> 
        </javac>
     <copy  todir="${build.dir}/WebContent/WEB-INF/classes"> 
          <fileset dir="../src">
             <exclude name="**/*.java"/>
             <include name="**/*.xml"/>
             <include name="**/*.ibatis"/>
             <include name="**/*.properties"/>
             <include name="**/*.js"/>
             <include name="**/*.css"/>
          </fileset>
      <!--<fileset dir="${cfg.dir}"/>-->
      </copy>
      <copy todir="${build.dir}/WebContent/">
      <fileset dir="../WebContent"></fileset>
      </copy>
</target> 


<!-- ================================================================== -->
<!-- Make Dorado Web Project war file                                   -->
<!-- ================================================================== -->
<target name="war" depends="compile">
<war destfile="${build.dir}/${final.name}.war" webxml="${build.dir}/WebContent/WEB-INF/web.xml">
<fileset dir="${build.dir}/WebContent/" />
<!--<zipfileset prefix="WEB-INF/classes/dorado-home" dir="${build.dir}/dorado-home" />-->
</war>
</target>

<!-- ================================================================== -->
<!-- Clean Dorado build file                                   -->
<!-- ================================================================== -->

<target name="clean">
<delete dir="${build.dir}" />
</target>

<!-- copy war -->
<target name="copywar">
<delete dir="${catalina.home}/webapps/SCM" />
    <delete file="${catalina.home}/webapps/SCM.war" />
    <copy  todir="${catalina.home}/webapps/">
    <fileset file="${build.dir}/SCM.war"/>
</copy>
</target>



<target name="package" depends="clean,init,compile,war,copywar">
</target>

</project>


注意点
A. 打包包含资源文件
<fileset dir="../src">
             <exclude name="**/*.java"/>
             <include name="**/*.xml"/>
             <include name="**/*.ibatis"/>
             <include name="**/*.properties"/>
             <include name="**/*.js"/>
             <include name="**/*.css"/>
</fileset>
B.编译带上 debug="true" 不关联源文件
<javac source="1.6" target="1.6" fork="true" executable="C:\Program Files\Java\jdk1.6.0_13\bin\javac" debug="true"

==========scm_auto_package.bat start==========
echo 'kill tomcat'
call taskkill /IM java.exe
echo 'update sql'
cd F:\SCM_SAAS\sql
rem #rm -rf /home/admin/scm/source/*
call svn  -q --force checkout https://localhost:5032/svn/xxx --username=xxx --password=xxx
call xcopy /S/Y F:\SCM_SAAS\sql\设计文档  F:\tools\SQLTool\sql
call F:\tools\SQLTool\runSQL.bat
rem #call svn update
echo 'db update end'
call F:\SCM_SAAS\scm2_package.bat
cd F:\SCM_SAAS
call F:\apache-tomcat-7.0.16\bin\startup.bat
echo 'update sql ok'
===========scm_auto_package.bat end==================

===========scm2_package.bat end==================
echo 'update source'
cd F:\SCM_SAAS\source
rem #rm -rf /home/admin/scm/source/*
call svn checkout https://localhost:5032/svn/xxx --username=xxxx --password=xxxx
rem #call svn update
cd F:\SCM_SAAS\source\SCM2.0\script
call ant package
cd F:\SCM_SAAS
echo 'update source ok'
===========scm2_package.bat end==================



热点排行