Ant's Simple use case

Source: Internet
Author: User

Build.xml

<?XML version= "1.0" encoding= "UTF-8"?><Projectname= "HelloWorld"default= "Run"Basedir=".">    <!--definition -    < Propertyname= "src"value= "src" />    < Propertyname= "Dest"value= "Classes" />    < Propertyname= "Ant_jar"value= "Myant.jar" />    < Propertyname= "Ant_zip"value= "Myant.zip" />    < Propertyname= "Lib"value= "Lib"/>        <!--Clean up Delete folders and files -    <Targetname= "clean">        <Deletedir= "${dest}"/>        <Deletefile= "${lib}/${ant_jar}"/>        <Deletefile= "${ant_jar}"/>        <Deletefile= "${ant_zip}"/>    </Target>        <!--first create a classes folder, based on "clean" -    <Targetname= "Init"depends= "clean">        <mkdirdir= "${dest}" />    </Target>        <!--Compile the Java file and compile the. java files in the SRC folder into the Classes folder based on clean. -     <Targetname= "Compile"depends= "Init">        <JavacSrcdir= "${src}"Destdir= "${dest}" >        <!--and the jar package in Lib is also in the lead. -            <Classpath>                <Filesetdir= "${lib}">                    <includename= "**/*.jar" />                </Fileset>            </Classpath>        </Javac>    </Target>        <!--build, based on compile -    <Targetname= "Build"depends= "Compile">            <!--Copy the properties and XML files under the SRC folder to the Classes folder -            <CopyTodir= "${dest}">            <Filesetdir= "src">                <includename= "**/*.properties" />                <includename= "**/*.xml" />            </Fileset>        </Copy>        <!--make the Classes folder into a jar package with the jar named "Myant.jar", including the. class file, XML, properties file -        <JarJarfile= "${ant_jar}"Basedir= "${dest}">            <includename= "Com/**/*.class" />            <includename= "**/*.xml" />            <includename= "**/*.properties" />        </Jar>        <!--Copy the "Myant.jar" jar package under the root directory to the Lib folder -        <CopyTodir= "${lib}">            <Filesetdir=".">                <includename= "${ant_jar}" />            </Fileset>        </Copy>        <!--Compress folders to compress all jar packages and Start.bat files under the Lib folder to "Myant.zip" files -        <ZipDestFile= "${ant_zip}"Compress= "true">            <Filesetdir="."includes= "${lib}/*.jar" />            <Filesetdir="."includes= "Start.bat" />            <Filesetdir="."includes= "killme.sh" />            <Filesetdir="."includes= "start.sh" />        </Zip>    </Target>    <!--run the Main method of Mymain in the "Myant.jar" jar package -    <Targetname= "Run"depends= "Build">        <JavaClassName= "Com.huawei.me.MyMain"Classpath= "${ant_jar}"/>    </Target>        <Targetname= "Rerun"depends= "Clean,run">        <AntTarget= "clean"/>        <AntTarget= "Run"/>    </Target></Project>

Start.bat

@echo OffSET 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=./libexport 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 $CLASSPATHjava-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 $} ' |xargs Kill-9echo ' kill process Crm ant01 work data  end '

Myant.zip

Ant's Simple use case

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.