ant 常用脚本
上一篇 /
下一篇 2014-03-11 17:05:41
/ 个人分类:scm
xml version="1.0" encoding="utf-8"?>
-<!--================================================
--> -<!--================================================
--> -<projectname="LuckyAppSrv"basedir="."default="main"> <description>com.llt.parkpay.user</description>
<propertyname="src.dir"value="src"/>
<propertyname="build.dir"value="build"/>
<propertyname="build.lib.dir"value="lib"/>
<propertyname="lib.dir"value="lib"/>
<propertyname="res.dir"value="res_test"/>
<propertyname="classes.dir"value="${build.dir}/bin"/>
<propertyname="jar.dir"value="${build.dir}"/>
<propertyname="version"value="0.1"/>
-<!--指定程序的版本号,该值会添加到生成jar文件的后面。
--> <propertyname="main-class"value="com.nnk.bazi.kyjl.app.start.Start"/>
<propertyname="encoding"value="UTF-8"/>
<propertyname="antlib.dir"value="ant-lib"/>
<propertyname="app.name"value="${ant.project.name}-${version}.jar"/>
<propertyname="app.dir"value="/usr/local/007ka/baizi/Kaiyun/LuckyAppSrv"/>
<propertyname="sh.dir"value="/usr/local/007ka/sh"/>
-<targetname="main"depends="clean, preapare, compile, copylib, jar,
resources,restart_app"description="控制编译执行流程"> <echo>, resources, cleanup, update, restart_app编译完成^_^</echo>
<echo>目标jar文件:${jar.dir}/${ant.project.name}-${version}.jar</echo>
</target>
-<!--- - - - - - - - - - - - -
--> -<!--- - - - - - - - - - - - -
--> -<targetname="clean"description="删除旧的二进制代码"> <deletedir="${build.dir}"/>
</target>
-<!--- - - - - - - - - - - - -
--> -<!--- - - - - - - - - - - - -
--> -<targetname="cleanup"description="清除编译的的二进制代码"> <deletedir="${classes.dir}"/>
</target>
-<targetname="preapare"depends="clean"description="准备文件目录"> <mkdirdir="${classes.dir}"description="存放字节码文件"/>
<mkdirdir="${jar.dir}"description="存放打包之后的jar文件"/>
</target>
-<targetname="compile"depends="preapare"description="编译java文件为字节码class"> -<javacsrcdir="${src.dir}"destdir="${classes.dir}"includeantruntime="false"source="1.6"target="1.6"debug="true"> <compilerargline="-encoding ${encoding}"/>
<pathelementpath="${antlib.dir}/ecj.jar"/>
</compilerclasspath>
-<filesetdir="${lib.dir}"> </classpath>
</javac>
</target>
-<targetname="copylib"depends="compile"description="复制第三方jar文件"> -<copytodir="${build.dir}/${build.lib.dir}"> -<filesetdir="${lib.dir}"> </copy>
</target>
-<pathconvertproperty="project.libs"pathsep=""description="定义程序的第三方jar文件路径"> <globmapperfrom="*"to="${build.lib.dir}/*"/>
</chainedmapper>
</mapper>
-<filesetdir="${lib.dir}"> <includename="**/*.jar"/>
</fileset>
</path>
</pathconvert>
-<targetname="jar"description="将字节码文件打包成jar文件"> -<jardestfile="${jar.dir}/${app.name}"basedir="${classes.dir}"> <attributename="Main-Class"value="${main-class}"/>
<attributename="Class-Path"value=". ${project.libs}"/>
</manifest>
</jar>
</target>
-<targetname="resources"depends="jar"description="配置运行需要的配置信息"> <mkdirdir="${app.dir}"description="程序运行路径"/>
-<copytodir="${app.dir}"overwrite="false"> -<filesetdir="${res.dir}"> </copy>
-<copytodir="${app.dir}/${build.lib.dir}"> -<filesetdir="${lib.dir}"> </copy>
<copytodir="${app.dir}"file="${jar.dir}/${app.name}"/>
-<!--antcall target="restart_app"></antcall
--> </target>
-<targetname="run"depends="resources"> <antcalltarget="shutdown_app"/>
<javaclasspath="."jar="${app.dir}/${app.name}"dir="${app.dir}"spawn="false"fork="true"/>
</target>
-<targetname="shutdown_app"description="关闭程序"> -<execexecutable="${sh.dir}/shutdown.sh"> <argvalue="${ant.project.name}"/>
</exec>
</target>
-<targetname="start_app"description="启动程序"> -<execexecutable="${sh.dir}/startup.sh"> <argvalue="${app.name}"/>
</exec>
</target>
-<targetname="restart_app"depends="resources"description="重启程序"> -<execexecutable="${sh.dir}/restart.sh"failonerror="true"> <argvalue="${ant.project.name}"/>
<argvalue="${app.name}"/>
</exec>
</target>
-<!--target name="clearUp" description="清理生成的临时文件">
<echo>清理构建中产生的临时文件</echo>
<delete dir="${classes.dir}" />
</target>
<target name="update" depends="jar" description="上传">
<echo message="将jar上传服务器" />
<scp file="${jar.dir}/${ant.project.name}-${version}.jar" todir="${user_253}:${password_253}@${address_253}"
trust="true" verbose="true"/>
<echo message="上传完毕" />
</target>
<target name="restart_app" depends="update" description="关闭重启应用程序">
<sshexec host="${host_253}" username="${user_253}" password="${password_253}" trust="true" command="sh/restart.sh ${ant.project.name} ${dir_253} ${app.name}" />
</target>
<target name="mk" >
<sshexec host="" username="" command="" failonerror="true" />
<exec dir="/ci/opt/cruisecontrol-bin-2.7.3/projects/maketest" executable="make" s="Linux" failonerror="true"/>
</target
--> </project>
收藏
举报
TAG: