什么什么ant(初级会计的职称是什么)

2019独角兽企业重金招聘Python工程师标准>>>…

大家好,又见面了,我是你们的朋友全栈君。

一、简介:
ANT是一个基于Java的生成工具,类似于Make。
生成工具在软件开发中用来将源代码和其他输入文件转换为可执行文件的形式(也有可能转换为可安装的产品映像形式)。随着应用程序的生成过程变得更加复杂,确保在每次生成期间都使用精确相同的生成步骤,同时实现尽可能多的自动化,以便及时产生一致的生成版本。

二、ANT如何工作
在安装好ant的环境中执行命令 ant,ant会开始在当前目录寻找build.xml文件(与Makefile文件类似),然后根据build.xml里定义的规则来生成工程。

三、buildfile(build.xml)
实例如下
<project name="MyProject" default="dist" basedir=".">
    <description>
        simple example build file
    </description>
  <!-- set global properties for this build -->
  <property name="src" location="src"/>
  <property name="build" location="build"/>
  <property name="dist"  location="dist"/>

  <target name="init">
    <!-- Create the time stamp -->
    <tstamp/>
    <!-- Create the build directory structure used by compile -->
    <mkdir dir="${build}"/>
  </target>

  <target name="compile" depends="init"
        description="compile the source " >
    <!-- Compile the java code from ${src} into ${build} -->
    <javac srcdir="${src}" destdir="${build}"/>
  </target>

  <target name="dist" depends="compile"
        description="generate the distribution" >
    <!-- Create the distribution directory -->
    <mkdir dir="${dist}/lib"/>

    <!-- Put everything in ${build} into the MyProject-${DSTAMP}.jar file -->
    <jar jarfile="${dist}/lib/MyProject-${DSTAMP}.jar" basedir="${build}"/>
  </target>

  <target name="clean"
        description="clean up" >
    <!-- Delete the ${build} and ${dist} directory trees -->
    <delete dir="${build}"/>
    <delete dir="${dist}"/>
  </target>
</project>

buildfile是XML文件,每个buildfile包含一个project节点(根节点),至少一个Target元素,以及任意个Property元素。
四、Targets
Target对象组织一组要执行的命令(也叫Task)。例如:
<target name=”
compile ” description=”compile the source” >
<javac srcdir=”${src}” destdir=”${build}”/>
</target>
执行ant命令时,可以通过指定target名来控制执行某一组命令。例如:ant clean
可执行命令列表:
http://ant.apache.org/manual/tasklist.html。
五、Property
Property标签是用来自定义生成过程,以及简化字符串(类似于C语言里的宏定义)的工具。
内置Property,无需定义,可以直接使用的属性
basedir                            the absolute path of the project's basedir (as set with the basedir attribute of <project>).
ant.file            the absolute path of the buildfile.
ant.version         the version of Ant
ant.project.name    the name of the project that is currently executing;
                    it is set in the name attribute of <project>.
ant.project.default-target
                    the name of the currently executing project's
                    default target;  it is set via the default
                    attribute of <project>.
ant.project.invoked-targets
                    a comma separated list of the targets that have
                    been specified on the command line (the IDE,
                    an <ant> task ...) when invoking the current
                    project.
ant.java.version    the JVM version Ant detected; currently it can hold
                    the values "1.2", "1.3",
                    "1.4",  "1.5" and "1.6".
ant.core.lib        the absolute path of the ant.jar file.
ant.home            home directory of Ant
ant.library.dir     the directory that has been used to load Ant's
                    jars from.  In most cases this is ANT_HOME/lib.

参考资料
Ant官网:
http://ant.apache.org/
Ant帮助文档:
http://ant.apache.org/manual/

转载于:https://my.oschina.net/shiw019/blog/144160

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/128371.html原文链接:https://javaforall.net

赞 (0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 关于精灵图

    关于精灵图之前就发现一些网站吧所有的小图标拼接在一张图片中,但是一直不知道这是怎么做到的,今天特地了解了一下,才知道这种用法叫做精灵图。他的优点是可以减少浏览器请求的次数,把所有图片拼接在一张图中就只需要请求一次,当浏览器需要用到图片时再从大图片中解析。这样可以加快访问的次数。先来看看效果图:拼接的图片:他的原理是,先规定好每个小图标的大小,创建一个和小图标大小相同的容器,再通过移动背景图片的方法将…

    2022年5月29日
  • Windows键失灵的三种处理方式「建议收藏」

    Windows键失灵的三种处理方式「建议收藏」对于经常使用电脑学习或者工作的我们来说,特别是搞编程的小伙伴们。Windows键的失灵将会导致我们的工作效率大大降低,比如:Win+E快速打开我的电脑;Win+R快速打开命令行等,许多组合键都不能使用,好烦躁。不要急,先看看这篇文章,可能有惊喜哦!

    2022年5月4日
  • 利用正则表达式限制网页表单里的文本框输入内容

    利用正则表达式限制网页表单里的文本框输入内容

    2021年7月28日
  • currentstyle 织梦_织梦DEDE栏目高亮channel属性currentstyle采用详解[通俗易懂]

    currentstyle 织梦_织梦DEDE栏目高亮channel属性currentstyle采用详解[通俗易懂]织梦DEDECMScms被点击的栏目高亮显示办法详解,织梦DEDE栏目高亮channel属性currentstyle采用详解,废话不多说直接举例说明:织梦DEDEchannel属性currentstyle的例子:{dede:channeltype=’self’currentstyle=”~typename~”}[field:typename/]{/dede:channel}看例子样式,通过对当…

    2022年7月14日
  • spi协议详解_一文看懂财务三张表

    spi协议详解_一文看懂财务三张表文章目录SPI协议简介4线还是3线?4种工作模式多种传输速率SPI协议的基本时序SPI协议的升级版FPGA实现SPI协议SPI和IIC的对比总结SPI协议简介板卡内不同芯片间通讯最常用的三种串行协议:UART、I2C、SPI,之前写过串口协议及其FPGA实现,今天我们来介绍SPI协议,SPI是SerialPerripheralInterface的简称,是由Motorola公司推出的一种高速、全双工的总线协议。与IIC类似,SPI也是采用主从方式工作,主机通常为FPGA、MCU或DSP等可编程控制

    2022年10月15日
  • Linux系统下查看版本信息

    查看Linux内核版本命令(两种方法):1、cat/proc/version显示正在运行的内核版本。[root@S-CentOS home]#cat/proc/versionLinuxversion2.6.32-431.el6.x86_64(mockbuild@c6b8.bsys.dev.centos.org)(gccversion4.4.720120313(RedHat …

    2022年4月5日

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号