ant学习之jar命令

时间:2022-05-05 11:51:24
<?xml version="1.0" ?>
<project name="antCopy" default="jar" basedir="../">
    <target name="clean">
        <delete dir="${basedir}/build" />
    </target>
    <target name="compile" depends="clean">
        <mkdir dir="${basedir}/build/classes" />
        <javac srcdir="${basedir}/AntMain" destdir="${basedir}/build/classes" includeantruntime="false" />
    </target>
    <target name="run" depends="compile">
        <java classname="com.xisong.ant.HelloAnt">
            <classpath>
                <pathelement path="${basedir}/build/classes" />
            </classpath>
        </java>
    </target>
    <target name="jar" depends="run">
        <jar destfile="dist/helloAnt.jar" basedir="${basedir}/build/classes">
            <manifest>
                <attribute name="Main-class" value="com.xisong.ant.HelloAnt" />
            </manifest>
        </jar>
    </target >
</project>

 

<target name="build_pushserver_server_jar" depends="init">    
      <jar destfile="${deploy}/build/pushServer.jar"
           basedir="${classes.dir}"
           includes="**/channelsoft/**">       
            <manifest>
                  <attribute name="Main-Class" value="com.channelsoft.pushserver.PushServer"/>
                  <attribute name="Class-Path" value="lib/commons-beanutils-1.6.jar lib/commons-collections.jar lib/commons-lang-2.0.jar lib/commons-logging-1.1.1.jar lib/ezmorph-1.0.4.jar lib/json-lib-2.2.1-jdk15.jar lib/log4j-1.2.15.jar lib/netty-3.1.5.GA.jar lib/protobuf-java-2.3.0.jar lib/spring.jar lib/quartz-all-1.6.4.jar"/>
                  <attribute name="Signature-Version" value="$Id: build.xml,v 1.0 2010/2/09 15:03:26 Fuwenbin Exp $"/>
            </manifest>                 
       </jar>       
    </target>