02_ANT_运行参数

Ant 命令 的参数

    1, ant -help
        打印帮助信息

    2, ant -projecthelp
        打印 build.xml 文件 中的 
        1)target 及其 tasks; 
        2)<project>标签的子标签<description>标签描述的信息
            如
            <description>
                    这是一个 Demo
                </description>
        3)<target>的属性 description 描述的信息
            如
                <target name="init" description="初始化的目标">
        4)打印指定build文件的描述
            ant -projecthelp -buildfile "build -2 description.xml"
        注意:
            <?xml version="1.0" encoding="UTF-8"?>
            build.xml 的文档声明 中的 编码, 必须跟 存盘 编码一致

    3, ant -version
        ANT的版本信息

    4, ant -diagnostics
        print information that might be helpful to diagnose or report problems.
        显示ant项目的运行环境,依赖库等信息,
        为诊断和报告提供一些有用的帮助信息.

    5, ant -debug
        print debugging information
        打印 ant 执行过程中的 详细的log信息
        
    6, ant -lib <path>            
        specifies a path to search for jars and classes
        将指定的 jar 或者 class 加入到 classpath 中.
        如
            ant -lib E:\360cloudDisk\lib\db_driver\sql2005\sqljdbc.jar -debug
    
    7, ant -logfile <file>        
        use given file for log
        将默认输出到控制台的信息, 写入指定文件
        如
            E:\desktop\Ant\OurProject>ant -logfile ant.log
                Buildfile: E:\desktop\Ant\OurProject\build.xml

    8, ant -quiet   ,or ant -q             
        be extra quiet
        打印很少的构建信息, 或者说隐藏 构建信息

    9, ant -verbose ,or ant -v           
        be extra verbose
        打印详解的构建信息
                   
    10,ant -buildfile <file>
        use given buildfile
        指定自定义名称的 build文件(构建文件)
        1) ant -buildfile "build2.xml"
        2) ant -buildfile "build -2 description.xml"  (文件名有空格的情况)

    11,-D<property>=<value>   
        use value for given property
        给变量赋值
        1) 在 <project>标签体中 使用<echo>标签 打印语句
           如
            <project> 
                ...
                <echo>=构建开始=</echo>
                ...
            </project>
            E:\desktop\Ant\OurProject>ant -buildfile "build.xml"
            Buildfile: E:\desktop\Ant\OurProject\build.xml
                 [echo] =构建开始=
        2) 给变量赋值, 相当于EL表达式
           如
            <project> 
                ...
                <echo>=构建开始= ${myVar} </echo>
                ...
            </project>             
            E:\desktop\Ant\OurProject>ant -DmyVar="嘿嘿"  -buildfile "build.xml"
            Buildfile: E:\desktop\Ant\OurProject\build.xml
                 [echo] =构建开始= 嘿嘿 

        3) 给 <property> 指定的变量 赋值
            如
             <property name="builder" value="me" />
        <echo>= 构建开始= ${builder}=</echo>
            注意:
                当 直接 执行 ant命令 时, 显示为  me
                当 执行 ant -Dbuilder="哈哈" 时, 显示为 哈哈
                即 在 命令行 动态指定 的值, 会覆盖 程序中写死的值.
            
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值