什么是学习蚂蚁最好的资源? [英] What are the best resources to learn Ant?

查看:111
本文介绍了什么是学习蚂蚁最好的资源?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想学蚂蚁。任何人都可以推荐一下这个主题的一些优秀的学习资源?任何资源pciated,来自网络的入门教程,以深入书籍AP $ P $。

感谢您的帮助!


解决方案

  1. ant.apache.org 。看手动

  2. 蚂蚁最佳实践

不会多久 - 蚂蚁并不难

下面是一个示例,可重复使用的相当build.xml文件就可以下手。这是很普通的,我重用。目录命名惯例应该很容易理解。我用模仿的IntelliJ从输出的布局。

 <?XML版本=1.0编码=UTF-8&GT?;
<项目名称=XSLT转换器的basedir =。默认为包>    <属性名=版本值=1.6/>
    <属性名=haltonfailure价值=无​​/>    <属性名=走出去值=OUT/>    <属性名=production.srcVALUE =SRC/>
    <属性名=production.libVALUE =lib目录/>
    <属性名=production.resourcesVALUE =配置/>
    <属性名=production.classes值=$ {}出/生产/ $ {} ant.project.name/>    <属性名=test.srcVALUE =测试/>
    <属性名=test.libVALUE =lib目录/>
    <属性名=test.resourcesVALUE =配置/>
    <属性名=test.classes值=$ {}出/测​​试/ $ {} ant.project.name/>    <属性名=爆炸VALUE =出/爆炸/ $ {} ant.project.name/>
    <属性名=exploded.classes值=$ {}爆炸/ WEB-INF / classes中/>
    <属性名=exploded.lib值=$ {}爆炸/ WEB-INF / lib目录/>    <属性名=reports.out值=$ {}出/报告/>
    <属性名=junit.out值=$ {} reports.out / JUnit的/>
    <属性名=testng.out值=$ {} reports.out / TestNG的/>    &所述;路径ID =production.class.path>
        < pathelement位置=$ {} production.classes/>
        < pathelement位置=$ {} production.resources/>
        <文件集DIR =$ {} production.lib>
            <包括姓名=** / *罐子。/>
            <排除NAME =** / JUnit的的* .jar/>
            <排除NAME =** / *测试的* .jar/>
        < /文件集>
    < /路径>    &所述;路径ID =test.class.path>
        <路径REFID =production.class.path/>
        < pathelement位置=$ {} test.classes/>
        < pathelement位置=$ {} test.resources/>
        <文件集DIR =$ {} test.lib>
            <包括姓名=** / JUnit的的* .jar/>
            <包括姓名=** / *测试的* .jar/>
        < /文件集>
    < /路径>    &所述;路径ID =testng.class.path>
        <文件集DIR =$ {} test.lib>
            <包括姓名=** / TestNG的的* .jar/>
        < /文件集>
    < /路径>    <可用文件=$ {}出属性=outputExists/>    <目标名称=干净描述=删除所有生成的构件如果=outputExists>
        <删除DIR =$ {}出includeEmptyDirs =真/>
        <删除DIR =$ {} reports.outincludeEmptyDirs =真/>
    < /目标与GT;    <目标名称=创造描述=创建输出目录,除非=outputExists>
        < MKDIR DIR =$ {} production.classes/>
        < MKDIR DIR =$ {} test.classes/>
        < MKDIR DIR =$ {} reports.out/>
        < MKDIR DIR =$ {} junit.out/>
        < MKDIR DIR =$ {} testng.out/>
        < MKDIR DIR =$ {} exploded.classes/>
        < MKDIR DIR =$ {} exploded.lib/>
    < /目标与GT;    <目标名称=编译描述=编译所有的.java源文件取决于=创造>
        <! - 调试输出
                <属性名=production.class.pathREFID =production.class.path/>
                <回声消息=$ {} production.class.path/>
         - >
        < javac的SRCDIR =SRCDESTDIR的源=$ {}版GT&=$ {}出/生产/ $ {} ant.project.name调试=;
            <类路径REFID =production.class.path/>
            <包括姓名=** / * java的。/>
            <排除NAME =** / * Test.java/>
        < / javac的>
        < javac的SRCDIR =$ {} test.srcDESTDIR =$ {}出/测​​试/ $ {} ant.project.name调试=的源=$ {}版>
            <类路径REFID =test.class.path/>
            <包括姓名=** / * Test.java/>
        < / javac的>
    < /目标与GT;    <目标名称=的JUnit测试描述=运行所有的JUnit测试依赖=编译>
        <! - 调试输出
                <属性名=test.class.pathREFID =test.class.path/>
                <回声消息=$ {} test.class.path/>
         - >
        < JUnit的printsummary =YEShaltonfailure =$ {} haltonfailure>
            <类路径REFID =test.class.path/>
            <格式化类型=XML/>
            < batchtest叉=YEStodir =$ {} junit.out>
                <文件集DIR =$ {} test.src>
                    <包括姓名=** / * Test.java/>
                < /文件集>
            < / batchtest>
        < / JUnit的>
        < junitreport todir =$ {} junit.out>
            <文件集DIR =$ {} junit.out>
                <包括姓名=TEST - * XML。/>
            < /文件集>
            <报告todir =$ {} junit.out格式=帧/>
        < / junitreport>
    < /目标与GT;    <的taskdef资源=testngtasksclasspathref =testng.class.path/>
    <目标名称=TestNG的测试描述=运行所有测试TestNG的依赖=编译>
        <! - 调试输出
                <属性名=test.class.pathREFID =test.class.path/>
                <回声消息=$ {} test.class.path/>
         - >
        < TestNG的classpathref =test.class.pathoutputDir =$ {} testng.outhaltOnFailure =$ {} haltonfailure冗长=2并行=办法经纬=50>
            < classfileset DIR =$ {}出/测​​试/ $ {} ant.project.name包括=** / *类。/>
        < / TestNG的>
    < /目标与GT;    <目标名称=爆炸描述=创建爆炸部署取决于=TestNG的测试>
        <副本todir =$ {} exploded.classes>
            <文件集DIR =$ {} production.classes/>
        < /复制>
        <副本todir =$ {} exploded.lib>
            <文件集DIR =$ {} production.lib/>
        < /复制>
    < /目标与GT;    <目标名称=包描述=创建文件包取决于=爆炸>
        <罐子destfile =$ {出} / $ {} ant.project.name的.jarBASEDIR =$ {} production.classes包括=** / *类。/>
    < /目标与GT;< /项目>

I would like to learn Ant. Can anyone recommend some good learning resources about this topic? Any resource is appreciated, from online introductory tutorials to in-depth books.

Thanks for your help!

解决方案

  1. ant.apache.org. Look at the manual.
  2. Ant Best Practices

Won't take long - Ant's not hard.

Here's a sample, fairly reusable build.xml you can start with. It's generic enough for me to reuse. The directory naming convention should be easy to follow. I use a layout that mimics the output from IntelliJ.

<?xml version="1.0" encoding="UTF-8"?>
<project name="xslt-converter" basedir="." default="package">

    <property name="version" value="1.6"/>
    <property name="haltonfailure" value="no"/>

    <property name="out" value="out"/>

    <property name="production.src" value="src"/>
    <property name="production.lib" value="lib"/>
    <property name="production.resources" value="config"/>
    <property name="production.classes" value="${out}/production/${ant.project.name}"/>

    <property name="test.src" value="test"/>
    <property name="test.lib" value="lib"/>
    <property name="test.resources" value="config"/>
    <property name="test.classes" value="${out}/test/${ant.project.name}"/>

    <property name="exploded" value="out/exploded/${ant.project.name}"/>
    <property name="exploded.classes" value="${exploded}/WEB-INF/classes"/>
    <property name="exploded.lib" value="${exploded}/WEB-INF/lib"/>

    <property name="reports.out" value="${out}/reports"/>
    <property name="junit.out" value="${reports.out}/junit"/>
    <property name="testng.out" value="${reports.out}/testng"/>

    <path id="production.class.path">
        <pathelement location="${production.classes}"/>
        <pathelement location="${production.resources}"/>
        <fileset dir="${production.lib}">
            <include name="**/*.jar"/>
            <exclude name="**/junit*.jar"/>
            <exclude name="**/*test*.jar"/>
        </fileset>
    </path>

    <path id="test.class.path">                            
        <path refid="production.class.path"/>
        <pathelement location="${test.classes}"/>
        <pathelement location="${test.resources}"/>
        <fileset dir="${test.lib}">
            <include name="**/junit*.jar"/>
            <include name="**/*test*.jar"/>
        </fileset>
    </path>

    <path id="testng.class.path">
        <fileset dir="${test.lib}">
            <include name="**/testng*.jar"/>
        </fileset>
    </path>

    <available file="${out}" property="outputExists"/>

    <target name="clean" description="remove all generated artifacts" if="outputExists">
        <delete dir="${out}" includeEmptyDirs="true"/>
        <delete dir="${reports.out}" includeEmptyDirs="true"/>
    </target>

    <target name="create" description="create the output directories" unless="outputExists">
        <mkdir dir="${production.classes}"/>
        <mkdir dir="${test.classes}"/>
        <mkdir dir="${reports.out}"/>
        <mkdir dir="${junit.out}"/>
        <mkdir dir="${testng.out}"/>
        <mkdir dir="${exploded.classes}"/>
        <mkdir dir="${exploded.lib}"/>
    </target>

    <target name="compile" description="compile all .java source files" depends="create">
        <!-- Debug output
                <property name="production.class.path" refid="production.class.path"/>
                <echo message="${production.class.path}"/>
        -->
        <javac srcdir="src" destdir="${out}/production/${ant.project.name}" debug="on" source="${version}">
            <classpath refid="production.class.path"/>
            <include name="**/*.java"/>
            <exclude name="**/*Test.java"/>
        </javac>
        <javac srcdir="${test.src}" destdir="${out}/test/${ant.project.name}" debug="on" source="${version}">
            <classpath refid="test.class.path"/>
            <include name="**/*Test.java"/>
        </javac>
    </target>

    <target name="junit-test" description="run all junit tests" depends="compile">
        <!-- Debug output
                <property name="test.class.path" refid="test.class.path"/>
                <echo message="${test.class.path}"/>
        -->
        <junit printsummary="yes" haltonfailure="${haltonfailure}">
            <classpath refid="test.class.path"/>
            <formatter type="xml"/>
            <batchtest fork="yes" todir="${junit.out}">
                <fileset dir="${test.src}">
                    <include name="**/*Test.java"/>
                </fileset>
            </batchtest>
        </junit>
        <junitreport todir="${junit.out}">
            <fileset dir="${junit.out}">
                <include name="TEST-*.xml"/>
            </fileset>
            <report todir="${junit.out}" format="frames"/>
        </junitreport>
    </target>

    <taskdef resource="testngtasks" classpathref="testng.class.path"/>
    <target name="testng-test" description="run all testng tests" depends="compile">
        <!-- Debug output
                <property name="test.class.path" refid="test.class.path"/>
                <echo message="${test.class.path}"/>
        -->
        <testng classpathref="test.class.path" outputDir="${testng.out}" haltOnFailure="${haltonfailure}" verbose="2" parallel="methods" threadcount="50">
            <classfileset dir="${out}/test/${ant.project.name}" includes="**/*.class"/>
        </testng>
    </target>

    <target name="exploded" description="create exploded deployment" depends="testng-test">
        <copy todir="${exploded.classes}">
            <fileset dir="${production.classes}"/>
        </copy>
        <copy todir="${exploded.lib}">
            <fileset dir="${production.lib}"/>
        </copy>
    </target>

    <target name="package" description="create package file" depends="exploded">
        <jar destfile="${out}/${ant.project.name}.jar" basedir="${production.classes}" includes="**/*.class"/>
    </target>

</project>

这篇关于什么是学习蚂蚁最好的资源?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆