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>
    

      

  • 相关阅读:
    JWT验证
    SQLite报错: no such column:StamoRule(表名)
    .Net Core 程序报错 在上一个操作完成之前,在此上下文上启动了第二个操作。
    接口请求报错 504 Gateway Time-out
    未处理的异常:system.io.file load exception:无法加载文件或程序集“ 。。。。 找到的程序集的清单定义与程序集引用不匹配。
    好多年没回到这个园子
    模拟webpack 实现自己的打包工具
    微信小程序迁移到头条小程序工具
    手机端图片懒加载
    react系列一,react虚拟dom如何转成真实的dom
  • 原文地址:https://www.cnblogs.com/tianhao/p/4220648.html
Copyright © 2011-2022 走看看