??xml version="1.0" encoding="utf-8" standalone="yes"?>欧美男人的天堂,亚洲视频 欧洲视频,一区二区不卡在线视频 午夜欧美不卡'http://www.shnenglu.com/epubcn/category/6495.htmlzh-cnSat, 24 May 2008 06:25:40 GMTSat, 24 May 2008 06:25:40 GMT60[转蝲] ANT的安?配置W记http://www.shnenglu.com/epubcn/articles/45217.htmlp色系l?/dc:creator>p色系l?/author>Sun, 23 Mar 2008 14:45:00 GMThttp://www.shnenglu.com/epubcn/articles/45217.htmlhttp://www.shnenglu.com/epubcn/comments/45217.htmlhttp://www.shnenglu.com/epubcn/articles/45217.html#Feedback0http://www.shnenglu.com/epubcn/comments/commentRss/45217.htmlhttp://www.shnenglu.com/epubcn/services/trackbacks/45217.html

内容摘要Q?br>ant是一个基于JAVA的自动化脚本引擎Q脚本格式ؓ(f)XML。除?jin)做JAVA~译相关d外,ANTq可以通过插g实现很多应用的调用?br>

  1. ANT的基本概念:(x)
  2. ANT的安装:(x)解包Q设|\?
  3. ANT的用:(x)最好的学习(fn)只不q是一个简单实用的例子h……

ANT的基本概念:(x)Java的Makefile

当一个代码项目大?jin)以后,每次重新~译Q打包,试{都?x)变得非常复杂而且重复Q因此c语言中有make脚本来帮助这些工作的扚w完成。在Java 中应用是q_无关性的Q当然不?x)用q_相关的make脚本来完成这些批处理d?jin),ANT本n是q样一个流E脚本引擎,用于自动化调用程序完成项目的~译Q打包,试{。除?jin)基于JAVA是^台无关的外,脚本的格式是ZXML的,比make脚本来说q要好维护一些?br>

每个ant脚本Q缺省叫build.xmlQ中讄?jin)一pdd(target)Q比如对于一个一般的目可能需要有以下d?/p>

  • d1Qusage 打印本脚本的帮助信息Q缺省)(j)
  • d2Qclean <-- init 清空初始化环?
  • d3Qjavadoc <-- build <-- init 生成JAVADOC
  • d4Qjar <-- build <-- init 生成JAR
  • d5Qall <-- jar + javadoc <-- build <-- init 完成以上所有Q务:(x)jar javadoc
而多个Q务之间往往又包含了(jin)一定了(jin)依赖关系Q比如把整个应用打包d(jar)的这个依赖于~译d(build)Q而编译Q务又依赖于整个环境初始化d(init){?br>
注:(x)我看到很多项目的ant脚本中的命名基本上都是一致的Q比如:(x)~译一般叫build或者compileQ打包一般叫jar或warQ生成文一般命名ؓ(f)javadoc或javadocsQ执行全部Q务all。在每个d的中QANT?x)根据配|调用一些外部应用ƈ配以相应参数执行。虽然ANT可调用的外部应用U类非常丰富Q但其实最常用的就2Q?个:(x)比如javac javadoc jar{?

ANT的安?/h2> 解包后在pȝ可执行\径中加入指向ant的bin的\径就可以?jin),比如可以在GNU/Linux上把以下配置加入/etc/profile中:(x)
export ANT_HOME=/home/ant
export JAVA_HOME=/usr/java/j2sdk1.4.1
export PATH=$PATH:$JAVA_HOME/bin:$ANT_HOME/bin

q样执行ant 后,如果不指定配|文件ant?x)缺省找build.xmlq个配置文gQƈҎ(gu)配置文g执行dQ缺省的d讄可以指向最常用的Q务,比如Q?buildQ或指向打印帮助信息QusageQ告诉用h那些脚本选项可以使用?br>

ANT的?br>

最好的学习(fn)q程是看懂那些open source目中的build.xml脚本Q然后根据自q需要简化成一个更单的QANT和APACHE上很多非常工E派的项目:(x)单易用,而且适应性非常强Q因些项目的建立往往来源于开发h员日常最直接的需求?br>以下是的一?a >WebLucene应用的例子:(x)修改?a >JDOM的build.xmlQ?br>
<project default="usage" basedir=".">

  <!-- =================================================================== -->
  <!-- Initialization target                                               -->
  <!-- =================================================================== -->
  <target name="init">
    <tstamp/>
    <property file="${basedir}/build.properties" />
    <property name="Name" value="ProjectFullName"/>
    <property name="name" value="project_name"/>
    <property name="version" value="0.2"/>
    <property name="year" value="2003"/>

    <echo message="----------- ${Name} ${version} [${year}] ------------"/>

    <property name="debug" value="off"/>
    <property name="optimize" value="on"/>
    <property name="deprecation" value="on"/>

    <property name="src.dir" value="./src/WEB-INF/src"/>
    <property name="lib.dir" value="./src/WEB-INF/lib"/>
    <property name="packages" value="com.chedong.*,org.apache.lucene.*"/>

    <property name="build.src" value="./src/WEB-INF/build"/>
    <property name="build.dest" value="./src/WEB-INF/classes"/>
    <property name="build.javadocs" value="./src/doc"/>
   
    <path id="classpath">
        <pathelement path="${jsdk_jar}"/>
        <fileset dir="${lib.dir}">
           <include name="**/*.jar"/>
        </fileset>
    </path>
   
    <filter token="year" value="${year}"/>
    <filter token="version" value="${version}"/>
    <filter token="date" value="${TODAY}"/>
    <filter token="log" value="true"/>
    <filter token="verbose" value="true"/>
  </target>

  <!-- =================================================================== -->
  <!-- Help on usage                                                       -->
  <!-- =================================================================== -->
  <target name="usage" depends="init">
    <echo message="${Name} Build file"/>
    <echo message="-------------------------------------------------------------"/>
    <echo message=""/>
    <echo message=" available targets are:"/>
    <echo message=""/>
    <echo message="   jar      --> generates the ${name}.jar file"/>
    <echo message="   build    --> compiles the source code"/>
    <echo message="   javadoc  --> generates the API documentation"/>
    <echo message="   clean    --> cleans up the directory"/>
    <echo message=""/>
    <echo message=" Please rename build.properties.default to build.properties"/>
    <echo message=" and edit build.properties to specify JSDK 2.3 classpath."/>
    <echo message=""/>
    <echo message=" See the comments inside the build.xml file for more details."/>
    <echo message="-------------------------------------------------------------"/>
    <echo message=""/>
    <echo message=""/>
  </target>

  <!-- =================================================================== -->
  <!-- Prepares the source code                                            -->
  <!-- =================================================================== -->
  <target name="prepare-src" depends="init">
    <!-- create directories -->
    <mkdir dir="${build.src}"/>
    <mkdir dir="${build.dest}"/>
   
    <!-- copy src files -->
    <copy todir="${build.src}">
      <fileset dir="${src.dir}"/>
    </copy>
  </target>

  <!-- =================================================================== -->
  <!-- Compiles the source directory                                       -->
  <!-- =================================================================== -->
  <target name="build" depends="prepare-src">
    <javac srcdir="${build.src}"
           destdir="${build.dest}"
           debug="${debug}"
           optimize="${optimize}">
      <classpath refid="classpath"/>
    </javac>
  </target>

  <!-- =================================================================== -->
  <!-- Creates the class package                                           -->
  <!-- =================================================================== -->
  <target name="jar" depends="build">
    <jar jarfile="${lib.dir}/${name}.jar"
         basedir="${build.dest}"
         includes="**"/>
  </target>

  <!-- =================================================================== -->
  <!-- Creates the API documentation                                       -->
  <!-- =================================================================== -->
  <target name="javadoc" depends="build">
    <mkdir dir="${build.javadocs}"/>
    <javadoc packagenames="${packages}"
             sourcepath="${build.src}"
             destdir="${build.javadocs}"
             author="true"
             version="true"
             use="true"
             splitindex="true"
             windowtitle="${Name} API"
             doctitle="${Name}">
      <classpath refid="classpath"/>
    </javadoc>
  </target>

  <!-- =================================================================== -->
  <!-- Clean targets                                                       -->
  <!-- =================================================================== -->
  <target name="clean" depends="init">
    <delete dir="${build.src}"/>
    <delete dir="${build.dest}/org"/>
    <delete dir="${build.dest}/com"/>
    <delete>
      <fileset dir="${build.dest}" includes="**/*.class"/>
    </delete>
  </target>
</project>
<!-- End of file -->

~省dQusage 打印帮助文Q告诉有那些d选项Q可用的有build, jar, javadoc和clean.

初始化环境变量:(x)init
所有Q务都Z一些基本环境变量的讄初始化完成,是后l其他Q务的基础Q在环境初始化过E中Q有2Ҏ(gu)较可以方便设|:(x)

1 除了(jin)使用却缺省的property讄?jin)JAVA源\径和输出路径外,引用?jin)一个外部的build.properties文g中的讄Q?br><property file="${basedir}/build.properties" />
q样大部分简单配|用户只要会(x)看懂build.properties可以了(jin)Q毕竟XML比vkey value的属性文件还是要可读性差一些。用build.properties也可以方便其他用户从~译的细节中解放出来?br>
2 CLASSPATH讄Q用了(jin)其中的:(x)
    <path id="classpath">
        <pathelement path="${jsdk_jar}"/>
        <fileset dir="${lib.dir}">
           <include name="**/*.jar"/>
        </fileset>
    </path>
则相当于讄?jin)?x)CLASSPATH=/path/to/resin/lib/jsdk23.jar; /path/to/project/lib/*.jar;

文g复制Qprepare-src
创徏临时SRC存放目录和输出目录?br>  <!-- =================================================================== -->
  <!-- Prepares the source code                                            -->
  <!-- =================================================================== -->
  <target name="prepare-src" depends="init">
    <!-- create directories -->
    <mkdir dir="${build.src}"/>
    <mkdir dir="${build.dest}"/>
   
    <!-- copy src files -->
    <copy todir="${build.src}">
      <fileset dir="${src.dir}"/>
    </copy>
  </target>

~译dQbuild
~译时的CLASSPATH环境通过一下方式找到引用一个path对象
<classpath refid="classpath"/>

打包dQjar
对应用打包生成项目所写名?jar文g
  <!-- =================================================================== -->
  <!-- Creates the class package                                           -->
  <!-- =================================================================== -->
  <target name="jar" depends="build">
    <jar jarfile="${lib.dir}/${name}.jar"
         basedir="${build.dest}"
         includes="**"/>
  </target>

生成JAVADOC文d: javadoc
  <!-- =================================================================== -->
  <!-- Creates the API documentation                                       -->
  <!-- =================================================================== -->
  <target name="javadoc" depends="build">
    <mkdir dir="${build.javadocs}"/>
    <javadoc packagenames="${packages}"
             sourcepath="${build.src}"
             destdir="${build.javadocs}"
             author="true"
             version="true"
             use="true"
             splitindex="true"
             windowtitle="${Name} API"
             doctitle="${Name}">
      <classpath refid="classpath"/>
    </javadoc>
  </target>

清空临时~译文gQclean
  <!-- =================================================================== -->
  <!-- Clean targets                                                       -->
  <!-- =================================================================== -->
  <target name="clean" depends="init">
    <delete dir="${build.src}"/>
    <delete dir="${build.dest}/org"/>
    <delete dir="${build.dest}/com"/>
    <delete>
      <fileset dir="${build.dest}" includes="**/*.class"/>
    </delete>
  </target>

TODOQ?br>更多d/扩展Q(样例Q?br>
  • 试dQJUnit试
  • 代码风格(g)查Q务:(x)CheckStyleQJalopy{?
  • 邮g警报dQ可以把以上q些d的输?gu)告发送到制定的用户列表中Q这个Q务可以设|每天自动运行?

参考资料:(x)

Jakarta ANT:
http://ant.apache.org



]]>
青青草原综合久久大伊人导航_色综合久久天天综合_日日噜噜夜夜狠狠久久丁香五月_热久久这里只有精品
  • <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>
            þ޲| Ʒÿո| ޻ɫһ| ŷո| ŷһ| ߹ۿ| ľƷ99þù㽶| ƷŮþ| ŷһҹƵ߹ۿ| ҹƷþþ| ޵һۺվ| ŷ˹ˬˬˬ| ŷӰԺ| ŷƵ| þҹƷ| Ƶ㽶| Ůͬvideos| ޳Ƶվ| һ| Ʒһþ| ŷƬ18| Ʒþþþþþþ | ŷ龫Ʒþþþþ | 99Ʒŷһ| һ| ھƷԲ߹ۿ| ŷ| պƷһ| ŷһ| Ʒһҳ| Ļ| ŷ91| ޾ѡ| ݺۺϾþavһС˵| ޾ƷСƵ| һƷ߲| СƵ| Ůɫ| þۺϾþۺֻоƷ | ŷƷպƷ| ޸Ƶ߹ۿ| պŷһ| 99vþۺϺݺۺϾþ| Ʒ1234| ĶŷС˵| 99Ʒ99þþþþ| ŷһһƵ| ҹþƷþþþ| ŷƷ| ޸վ| ŷպƷ| ŷһһ| ŷһ| ŷҹƷƬa۽ ŷҹƷƬaĦ | þۺɫһ| ŷӰȷ| ŷɫaƵһպƷ| ŷIJ| ޾| պƷѹۿƵ| 鶹þ| ݺݾþŷ| þùƷһ| þþƷһ| ¾ƷƷ㶮| ŷaaa| ŷһƵ| һ߹ۿƵ| ҹavӰͬ| й˻ɫ| Ʒ99һ| Ļ| ŷѹۿ| ŷպƷ˿߸Ь| һ| ŷĻƵ| һþҺ| ŷһžž| 鶹һ| ߳| ŷƷպ| һɫ| ŷһ| Ƶþþþ| þһƷ | ŷa߹ۿ| Ʒͨ99| һƵ߿| ҹۺϼ| ߿պav| ŷպ߲| լ66ձŷƵ| С۾Ʒ| ɫպ| ŷպƷһС˵| 99Ƶպ| ֻƷ99re8| | ëƬһ| ŷ߾Ʒһ| ߳˾Ʒ| ŷ˾Ʒh߹ۿ| ҹҹҹƷ| Ʒ| Ѹһ| Ƶ߹ۿ| ŷ߹ۿ| ŷպۺ| ޻ɫվ| ŷƷպ鶹 | ŷձ| ҹƷƵ| պŷƵһ| һ߲| ŷƵ| þùƷվ| һƵ| ޵Ӱ߹ۿ| þþþŮʦһ| ˿avһ| 91þþ| ݺady޾Ʒ| ƷþþþþþҹƬ| ŷƵ| ŷרר| ҹƬ| 99ƷƵѹۿһ| 鶹ѾƷƵ| þþۺ| ŷһ߲| ľþһ| ޹崿| ߹ۿպ| ģ˽һ| Ʒۺ| Ʒ| Ʒһ| Ʒɫ| ŷɫƷ߹ۿƵ | ŷƷ߹ۿ| ͸ŷŮ| ˾޾Ʒ| avһaƬþ| þþþƵ| þþþһ| þþһ| þüƵþ| þþƷһ| þƵᆱƷ99㽶| þ޹| ŷfreesex8һ10Ʒ| ŷһ| ŷƷþþþa| ŷ| ŷƵһ߹ۿ| ŷպŷһ| ŷպ߹ۿ| ŷҹӰ| ŷպƵһ| ޾ƷþƮ| Ʒٸһ| ձŷպ߹ۿ| պۺ| ҹƷþþþþþ99˳| 㽶þҹɫƷ| þ޾ƷƵ| ޵һƷþDz| ŷ߲| ŮƵ| þƵƵ| ŷþó| Ʒŷպһ| һþ| ޼Ƶ| ҹƵ߹ۿ| þҹɫƷһ| ޾Ʒþ7777| Ƶ1819pþ| ŷƵ| ŷƵ| ޾ƷþþþĻӭ | ޾Ʒþþþþþþ| Ըм| þþþþ91| ޾ƷۺϾƷ| ŷ߹ۿ㶮| ŷձ| ݺɫۺһ| һƷ| þþƷһ| ޹Ʒƾþ| ŷպ| ŷƬ1ҳ| Իѹۿþþ| Ĺ˾Ʒþһ| þþþۺ| Ƶ| ŷƵ| ĸƵѲų | ޹һ|