ant的build.xml备份

<?xml version="1.0" encoding="UTF-8" ?>

<project default="rerun" name="codex-game">

<!-- project  property -->

<property name="lib.dir" value="../third-libs" />

<property name="src.dir" value="src" />

 

<!--

<property name="core.moniter.dir" value="../dawn-core/moniter" />

<property name="core.src.dir" value="../dawn-core/src" />

<property name="dbs.src.dir" value="../dawn-dbs/src" />

<property name="dbs.test.dir" value="../dawn-dbs/test" />

<property name="logserver.src.dir" value="../logserver/src" />

-->

 

<property name="deploy.dir" value="deploy" />

<property name="classes.dir" value="deploy/classes" />

 

<property name="jarname" value="codex-game.jar" />

<property name="mainclass" value="com.mop.game.gameserver.GameServer" />

 

<property name="core.jar" value="codex-core/deploy/codex-core.jar" />

<property name="dbs.jar" value="codex-db/deploy/codex-db.jar" />

<property name="battle.jar" value="codex-battle/deploy/codex-battle.jar" />

<property name="log.jar" value="logserver/deploy/logserver.jar" />

 

<!-- third jar path -->

<path id="lib-classpath">

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

<include name="**/*.jar" />

</fileset>

<fileset dir="../">

<include name="${core.jar}" />

</fileset>

<fileset dir="../">

<include name="${dbs.jar}" />

</fileset>

<fileset dir="../">

<include name="${battle.jar}" />

</fileset>

<fileset dir="../">

<include name="${log.jar}" />

</fileset>

</path>

 

 

<!-- 1. init, eg.create path -->

<target name="init">

<mkdir dir="${deploy.dir}" />

<mkdir dir="${classes.dir}" />

</target>

 

 

<!-- 2. compile -->

<target name="compile" depends="init">

<javac destdir="${classes.dir}" includeantruntime="on">

<src path="${src.dir}" />

<compilerarg line="-encoding UTF-8" />

<classpath refid="lib-classpath" />

</javac>

</target>

 

 

<!-- 3. build jar -->

<target name="build" depends="compile">

<copy todir="${deploy.dir}/lib">

<fileset dir="${lib.dir}" />

<file name="../${core.jar}" />

<file name="../${dbs.jar}" />

<file name="../${battle.jar}" />

<file name="../${log.jar}" />

</copy>

 

<copy todir="${deploy.dir}">

<fileset dir="../codex-db/resource" />

</copy>

 

<copy todir="${deploy.dir}">

<fileset dir="resource" />

</copy>

 

<!--Create a property containing all .jar files, prefix lib/, and seperated with a space-->

<pathconvert property="mf.classpath" pathsep=" ">

<mapper>

<chainedmapper>

<!-- jar包文件只留文件名,去掉目录信息 -->

<flattenmapper />

<!-- add lib/ prefix -->

<globmapper from="*" to="lib/*" />

</chainedmapper>

</mapper>

<path refid="lib-classpath" />

</pathconvert>

 

<!-- jar文件的输出路径 -->

<jar destfile="${deploy.dir}/${jarname}" basedir="${classes.dir}">

<manifest>

<attribute name="Main-class" value="${mainclass}" />

<attribute name="Class-Path" value="${mf.classpath}" />

</manifest>

</jar>

<delete dir="${classes.dir}" />

</target>

 

<!-- run -->

<target name="run" depends="build">

<java classname="${mainclass}" classpath="${deploy.dir}/${jarname}" fork="true" failοnerrοr="true">

<classpath>

<pathelement path="${deploy.dir}" />

</classpath>

</java>

</target>

 

 

<target name="clean">

<delete file="${deploy.dir}/${jarname}" />

<delete dir="${deploy.dir}/lib" />

<delete dir="${classes.dir}" />

</target>

 

<target name="rebuild">

<ant target="clean" />

<ant target="build" />

</target>

 

<target name="rerun">

<!--ant target="clean" /-->

<ant target="run" />

</target>

 

</project>

 

 

 

 

 

 

 

 

 

 

 

 

<?xml version="1.0" encoding="UTF-8" ?>

<project default="rebuild" name="codex-core">

<!-- project  property -->

<property name="lib.dir" value="../third-libs" />

<property name="src.dir" value="src" />

<property name="moniter.dir" value="moniter" />

 

<property name="deploy.dir" value="deploy" />

<property name="classes.dir" value="deploy/classes" />

 

<property name="jarname" value="codex-core.jar" />

 

<!-- third jar path -->

<path id="lib-classpath">

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

<include name="**/*.jar" />

</fileset>

</path>

 

 

<!-- 1. init, eg.create path -->

<target name="init">

<mkdir dir="${deploy.dir}" />

<mkdir dir="${classes.dir}" />

</target>

 

 

<!-- 2. compile -->

<target name="compile" depends="init">

<javac destdir="${classes.dir}" includeantruntime="on" debug="on" optimize="true">

<src path="${src.dir}" />

<src path="${moniter.dir}" />

<compilerarg line="-encoding UTF-8" />

<classpath refid="lib-classpath" />

</javac>

</target>

 

 

<!-- 3. build jar -->

<target name="build" depends="compile">

<copy todir="${deploy.dir}/lib">

<fileset dir="${lib.dir}" />

</copy>

 

<!--Create a property containing all .jar files, prefix lib/, and seperated with a space-->

<pathconvert property="mf.classpath" pathsep=" ">

<mapper>

<chainedmapper>

<!-- jar包文件只留文件名,去掉目录信息 -->

<flattenmapper />

<!-- add lib/ prefix -->

<globmapper from="*" to="lib/*" />

</chainedmapper>

</mapper>

<path refid="lib-classpath" />

</pathconvert>

 

<!-- jar file output -->

<jar destfile="${deploy.dir}/${jarname}" basedir="${classes.dir}">

<manifest>

<attribute name="Class-Path" value="${mf.classpath}" />

</manifest>

</jar>

<delete dir="${deploy.dir}/lib" />

<delete dir="${classes.dir}" />

</target>

 

 

<target name="clean">

<delete file="${deploy.dir}/${jarname}" />

<delete dir="${deploy.dir}/lib" />

<delete dir="${classes.dir}" />

</target>

 

 

<target name="rebuild">

<ant target="clean" />

<ant target="build" />

</target>

 

 

</project>

转载于:https://www.cnblogs.com/xingchong/p/8278741.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值