标签:
build.xml
<?xml version="1.0" encoding="UTF-8"?> <project name="HelloWorld" default="run" basedir="."> <!-- 定义 --> <property name="src" value="src" /> <property name="dest" value="classes" /> <property name="Ant_jar" value="myAnt.jar" /> <property name="Ant_zip" value="myAnt.zip" /> <property name="lib" value="lib"/> <!-- 清理 删除文件夹和文件 --> <target name="clean"> <delete dir="${dest}"/> <delete file="${lib}/${Ant_jar}"/> <delete file="${Ant_jar}"/> <delete file="${Ant_zip}"/> </target> <!--先创建一个classes文件夹,基于"clean"--> <target name="init" depends="clean"> <mkdir dir="${dest}" /> </target> <!--编译java文件,基于clean,将src文件夹里的.java文件编译到classes文件夹中--> <target name="compile" depends="init"> <javac srcdir="${src}" destdir="${dest}" > <!--并将lib中的jar包也导进去--> <classpath> <fileset dir="${lib}"> <include name="**/*.jar" /> </fileset> </classpath> </javac> </target> <!--构建,基于compile--> <target name="build" depends="compile"> <!--将src文件夹下的properties和xml文件拷贝到classes文件夹中--> <copy todir="${dest}"> <fileset dir="src"> <include name="**/*.properties" /> <include name="**/*.xml" /> </fileset> </copy> <!--将classes文件夹打成jar包,jar名为"myAnt.jar",包括.class文件、xml、properties文件--> <jar jarfile="${Ant_jar}" basedir="${dest}"> <include name="com/**/*.class" /> <include name="**/*.xml" /> <include name="**/*.properties" /> </jar> <!--将根目录下的"myAnt.jar"jar包拷贝到lib文件夹下--> <copy todir="${lib}"> <fileset dir="."> <include name="${Ant_jar}" /> </fileset> </copy> <!--压缩文件夹,将lib文件夹下所有jar包和start.bat文件压缩为"myAnt.zip"文件--> <zip destfile="${Ant_zip}" compress="true"> <fileset dir="." includes="${lib}/*.jar" /> <fileset dir="." includes="start.bat" /> <fileset dir="." includes="killMe.sh" /> <fileset dir="." includes="start.sh" /> </zip> </target> <!--运行"myAnt.jar"jar包中MyMain的main方法--> <target name="run" depends="build"> <java classname="com.huawei.me.MyMain" classpath="${Ant_jar}"/> </target> <target name="rerun" depends="clean,run"> <ant target="clean"/> <ant target="run"/> </target> </project>
start.bat
@echo off
SET CLASSPATH=%CLASSPATH%;lib/myAnt.jar;lib/aopalliance-1.0.jar;lib/aspectjweaver-1.7.2.jar;lib/c3p0-0.9.1.1.jar;lib/commons-beanutils-1.7.0.jar;lib/commons-betwixt-0.8.jar;lib/commons-codec-1.2.jar;lib/commons-collections-3.2.1.jar;lib/commons-configuration-1.10.jar;lib/commons-dbcp-1.4.jar;lib/commons-digester-1.7.jar;lib/commons-httpclient-3.1.jar;lib/commons-lang-2.6.jar;lib/commons-lang3-3.1.jar;lib/commons-pool-1.5.4.jar;lib/ezmorph-1.0.6.jar;lib/guava-15.0.jar;lib/ibatis-sqlmap-2.3.4.726.jar;lib/javax.inject-1.jar;lib/jboss-common-core-2.2.22.GA.jar;lib/jboss-logging-spi-2.1.0.GA.jar;lib/jcl-over-slf4j-1.7.5.jar;lib/json-lib-2.2-jdk15.jar;lib/jsr305-2.0.2.jar;lib/logback-classic-1.0.13.jar;lib/logback-core-1.0.13.jar;lib/lombok-1.12.2.jar;lib/ojdbc-11.1.0.7.0.jar;lib/quartz-2.2.1.jar;lib/slf4j-api-1.7.5.jar;lib/spring-aop-3.2.4.RELEASE.jar;lib/spring-aspects-3.2.4.RELEASE.jar;lib/spring-beans-3.2.4.RELEASE.jar;lib/spring-context-3.2.4.RELEASE.jar;lib/spring-context-support-3.2.4.RELEASE.jar;lib/spring-core-3.2.4.RELEASE.jar;lib/spring-expression-3.2.4.RELEASE.jar;lib/spring-jdbc-3.2.4.RELEASE.jar;lib/spring-orm-3.2.4.RELEASE.jar;lib/spring-tx-3.2.4.RELEASE.jar;
echo %CLASSPATH%
java -Xms128m -Xmx768m -Dfile.encoding=utf-8 -Dorg.quartz.scheduler.skipUpdateCheck=true com.huawei.me.MyMain
start.sh
export TERMINALLIB=./lib
export CLASSPATH="./:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/aopalliance-1.0.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/aspectjweaver-1.7.2.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/c3p0-0.9.1.1.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/commons-beanutils-1.7.0.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/commons-codec-1.2.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/commons-collections-3.2.1.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/commons-configuration-1.10.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/commons-dbcp-1.4.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/commons-digester-1.7.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/commons-httpclient-3.1.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/commons-lang-2.6.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/commons-lang3-3.1.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/commons-pool-1.5.4.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/ezmorph-1.0.6.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/ibatis-sqlmap-2.3.4.726.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/javax.inject-1.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/jcl-over-slf4j-1.7.5.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/json-lib-2.2-jdk15.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/jsr305-2.0.2.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/logback-classic-1.0.13.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/logback-core-1.0.13.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/lombok-1.12.2.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/ojdbc-11.1.0.7.0.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/quartz-2.2.1.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/slf4j-api-1.7.5.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/spring-aop-3.2.4.RELEASE.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/spring-aspects-3.2.4.RELEASE.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/spring-beans-3.2.4.RELEASE.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/spring-context-3.2.4.RELEASE.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/spring-context-support-3.2.4.RELEASE.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/spring-core-3.2.4.RELEASE.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/spring-expression-3.2.4.RELEASE.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/spring-jdbc-3.2.4.RELEASE.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/spring-orm-3.2.4.RELEASE.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/spring-tx-3.2.4.RELEASE.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/sunjce_provider.jar:$CLASSPATH"
export CLASSPATH="$TERMINALLIB/myAnt.jar:$CLASSPATH"
echo $CLASSPATH
java -Xms128m -Xmx768m -Dfile.encoding=utf-8 -Dorg.quartz.scheduler.skipUpdateCheck=true com.huawei.MyMain
killMe.sh
echo "kill process Crm ant01 work data ..."
ps -ef|egrep -e "ant01.MyMain" | grep -v grep|awk ‘{print $2}‘|xargs kill -9
echo "kill process Crm ant01 work data end"
myAnt.zip
标签:
原文地址:http://www.cnblogs.com/yxl0853133140/p/5145651.html