zoukankan      html  css  js  c++  java
  • ant—学习记录一

    <?xml version="1.0"?>
    <project name="helloWorld">
    <target name="sayHelloWorld">
    <echo message="Hello,xutianhao"/>
    </target>
    </project>
    <!-- ant_helloworld -->

      

    <?xml version="1.0"?>
    <project name="projectStudy" default="sayBaseDir" basedir="E:apache-ant-1.8.2-binapache-ant-1.8.2">
    <!-- default 代表默认要执行的动作  target-->
    <!-- basedir为用户设置的属性 如果去掉的话再执行,结果是e:即ant构建文件的父目录 -->
    <target name="sayBaseDir">
    <!-- 命令行中执行的语句  ant SayBasedir 即执行sayBaseDir步骤 -->
    <!-- 如果未指明执行的target 直接ant 会完成default指定的target-->
    <echo message="the base dir is:${basedir}"/>
    </target>
    <!-- 如果说在一个project里有两个name相同的target 
    运行结果为
    BUILD FAILED
    E:uild.xml:20: Duplicate target 'sayBaseDir'-->
    </project>
    

      

    <?xml version="1.0"?>
    
    <project name="targetStudy">
    <target name="targetA" if="ant.java.version">
    <!-- 如果 if属性存在 所在 target将被执行 -->
    <echo message="java.version:${ant.java.version}"/>
    </target>
    <target name="targetB" unless="amigo" depends="targetA">
    <!-- 如果 unless属性存在 所在target将不被执行 -->
    <!-- targetB依赖于targetA -->
    <!-- 运行ant targetB 先执行targetA(被依赖的)再执行targetB -->
    <description>a depend example!</description>
    <echo message="The base dir is:${basedir}"/>
    </target>
    </project>
    
    <!--运行结果
    E:>ant targetB
    Buildfile: E:uild.xml
    
    targetA:
         [echo] java.version:1.7
    
    targetB:
         [echo] The base dir is:E:
    
    BUILD SUCCESSFUL
    Total time: 0 seconds -->
    

      

    <?xml version="1.0"?>
    
    <project name="targetStudy">
    <target name="targetA">
    <echo message="The base dir is:${basedir}"/>
    <!-- project 基目录的绝对路径   代表当前目录-->
    <echo message="The ant.file is:${ant.file}"/>
    <!-- buildfile 的绝对路径 -->
    <echo message="The ant.java.version is:${ant.java.version}"/>
    <!-- ant 检测到的java版本  -->
    <echo message="The ant.version is:${ant.version}"/>
    <!-- ant 的版本 -->
    <echo message="The ant.project.name is:${ant.project.name}"/>
    <!-- 当前制定的project的name -->
    
    </target>
    </project>
    <!-- E:>ant targetA
    Buildfile: E:uild.xml
    
    targetA:
         [echo] The base dir is:E:
         [echo] The base dir is:E:uild.xml
         [echo] The base dir is:1.7
         [echo] The base dir is:Apache Ant(TM) version 1.8.2 compiled on December 20
     2010
         [echo] The base dir is:targetStudy
    
    BUILD SUCCESSFUL
    Total time: 0 seconds -->
    

      

    <?xml version="1.0"?>
    
    <project name="targetStudy">
    <property name="name" value="xutianhao"/>
    <property name="age"  value="23"/>
    <target name="targetA">
    <echo message="The base dir is:${name}"/>
    <!-- 设置的姓名属性 xutianhao-->
    <echo message="The base dir is:${age}"/>
    <!-- 设置的年龄属性23-->
    
    </target>
    </project>
    

      

  • 相关阅读:
    IDEA debug漏洞第一篇(weblogic,cve-2017-10271)
    IDEA+docker,进行远程漏洞调试(weblogic)
    2019-2020-1 20199326《Linux内核原理与分析》第四周作业
    2019-2020-1 20199326《Linux内核原理与分析》第三周作业
    2019-2020-1 20199326《Linux内核原理与分析》第二周作业
    2019-2020-1 20199326《Linux内核原理与分析》第一周作业
    DEV插件下的控件Grid和Gridlookupedit控件的结合使用
    foreach循环的简单写法
    dev设置子窗体的初始位置,grid控件表头的属性设置
    C#中,用户控件UserControl里面用Panl加载UserControl,并实现利用委托互相传值
  • 原文地址:https://www.cnblogs.com/tianhao/p/4220648.html
Copyright © 2011-2022 走看看