zoukankan      html  css  js  c++  java
  • Ant常用代码段

    Ant的介绍网上很多,就不赘述了。

    可参照:

    http://www.blogjava.net/zhengtengfeng/archive/2007/04/20/zhtfeng.html

    直接看例子:

    <?xml version="1.0" encoding="UTF-8"?>
    <project name="build_test" basedir=".">
        <!-- 
            import build.properties
            [build.properties]
            tomcat.home=D:/apache_tomcat_6.0.9    
        -->
        <property file="build.properties" />
    
    
        <property environment="env"/>
        <property name="SystemRoot.path" value="${env.SystemRoot}" />
        <property name="ANT_HOME.path" value="${env.ANT_HOME}" />
        <property name="OS.type" value="${env.OS}" />
        <target name="show-properties">
            <echo message="System Root: ${SystemRoot.path}" />
            <echo message="OS Type: ${OS.type}" />
            <echo message="Ant Home:${ant.home}" />
            <echo message="Ant Version:${ant.version}" />
            <echo message="Java Version:${ant.java.version}" />
        </target>
    
    
        <!-- start tomcat-->
        <target name="start-tomcat" description="start tomcat">
            <exec executable="${tomcat.home}/bin/startup.bat" spawn="true" vmlauncher="false">
                <env key="CATALINA_HOME" value="${tomcat.home}"/>
            </exec>
        </target>
    
        <!-- stop tomcat-->
        <target name="stop-tomcat" description="stop tomcat">
            <exec executable="${tomcat.home}/bin/shutdown.bat" spawn="true" vmlauncher="false">
                <env key="CATALINA_HOME" value="${tomcat.home}"/>
            </exec>
        </target>
    
    
        <!-- start browser-->
        <target name="open-browser">
            <exec executable="cmd">
                <arg line="/c start http://www.baidu.com" />
            </exec>
        </target>
    
        <!-- load file-->
        <target name="load-file">
            <loadfile property="MessageFromFile" srcFile="ContentInFile.txt"/>
            <echo  message="${MessageFromFile}" />
        </target>
    
    </project>

    有时候我们需要打一个jar包,jar包中需要有一个“META-INF”文件夹,里面创建一个“MANIFEST.MF”文件,下面的代码就能帮你实现:

    <jar jarfile="${jspdir}/WEB-INF/lib/test.jar" basedir="${destdir}" includes="com/XXX/**">
        <!-- define MANIFEST.MF -->
        <manifest>
            <attribute name="Manifest-Version" value="1.0" />
            <attribute name="Class-Path" value="" />
            <attribute name="Description" value="test." />
        </manifest>
        <metainf dir="./WEB-INF/tlds">
            <include name="*.tld"/> <!-- 拷贝一个tld文件到“META-INF”文件夹中 -->
        </metainf>
    </jar>

    更多示例代码段,可参照:

    http://rensanning.iteye.com/blog/1540336

  • 相关阅读:
    记一次逻辑代码的实现(数组内数据按照指定时间差进行分组)
    spark算子之Aggregate
    java.lang.SecurityException: class "javax.servlet.ServletRegistration"'s signer information does not match signer information of other classes in the same package
    Hive SQL之分区表与分桶表
    hive之基本架构
    数据结构-链表(2)
    jQuery 如何实现 模糊搜索
    常见的网站服务器架构
    window.location.href跳转无效
    js读取本地图片并显示
  • 原文地址:https://www.cnblogs.com/yejg1212/p/2955870.html
Copyright © 2011-2022 走看看