Skip to main content

A End to End ant Build xml snippet

A End to End ant Build xml snippet you could use for reference

<?xml version="1.0" encoding="UTF-8"?>
<project name="End to End Build" default="sendmail" basedir=".">

    <target name="init">
        <tstamp />
        <property file="build.properties" />
   
        <path id="classpath">
            <pathelement path="${servlet.jar}" />
            <pathelement path="${junit.jar}" />
        </path>



        <property name="classpath" refid="classpath" />
    </target>

    <target name="startrecorder">
        <record name="${name}-${DSTAMP}-log.txt"
                action="start"
                append="false" />
    </target>

    <target name="prepare" depends="init, startrecorder">
        <mkdir dir="${build.dir.classes}" />
        <mkdir dir="${reports.dir}" />
    </target>

    <target name="fetch" depends="init">
        <!-- <cvs dest="${src.dir}"
                  cvsRoot="${cvs.root}"
                  command="update -P -d"
                  failonerror="true" />
        /> -->
    </target>

    <target name="compile" depends="prepare, fetch">
        <javac srcdir="${src.dir}"
               destdir="${build.dir.classes}"
               classpath="${classpath}"
               compiler="${build.compiler}"
               debug="on"
               includeantruntime="false"  />
    </target>

    <target name="test" depends="compile">
        <junit failureproperty="testsFailed" />
        <junit printsummary="yes" haltonfailure="yes" showoutput="yes" >
            <classpath>
                <pathelement path="${classpath}" />
                <pathelement path="${build.dir.classes}" />
            </classpath>
            <formatter type="xml" />
            <batchtest fork="yes" todir="${reports.dir}/">
                <fileset dir="${src.dir}">
                    <include name="**/*Test*.java"/>
                </fileset>
            </batchtest>
        </junit>
   
        <junitreport todir="${reports.dir}">
            <fileset dir="${reports.dir}" includes="TEST-*.xml"/>
            <report format="noframes" todir="${reports.dir}"/>
        </junitreport>
    </target>

    <target name="war" depends="test" unless="testsFailed">
        <war destfile="${build.dir}/${war.name}" webxml="${etc.dir}/web.xml">
            <fileset dir="html"/>
            <fileset dir="jsp"/>
            <lib dir="libs"/>
            <classes dir="${build.dir.classes}">
                <include name="**/*.class" />
                <exclude name="**/*Test*.class" />
            </classes>
            <zipfileset dir="images"
              prefix="images"/>
        </war>
    </target>

    <target name="deploy" depends="war" unless="testsFailed">
       <ftp server="${server.name}"
             remotedir="${remote.dir}"
             userid="${user.id}"
             password="${password}"
             passive="yes"
             binary="yes"
             verbose="yes">
            <fileset dir="${build.dir}">
                <include name="${war.name}"/>
            </fileset>
        </ftp>
    </target>

    <target name="stoprecorder">
        <record name="${name}-${DSTAMP}-log.txt"
                action="stop" />
    </target>

    <target name="sendmail" depends="deploy, stoprecorder">
        <zip destfile="${name}-${DSTAMP}-reports.zip"
             basedir="${reports.dir}"
             excludes="**/*.xml" />
   
        <mail mailhost="${mail.host}"
              user="${mail.user}"
              password="${mail.pass}"
              ssl="true"
              mailport="${mail.port}"
              subject="Test build - ${DSTAMP}">
            <from address="${mail.from.address}"/>
            <to address="${mail.to.address}"/>
            <message src="${name}-${DSTAMP}-log.txt" />
            <attachments>
                <fileset dir=".">
                    <include name="${name}-${DSTAMP}-reports.zip"/>
                </fileset>
            </attachments>
        </mail>
    </target>

    <target name="clean" depends="init">
        <delete dir="${build.dir}" />
        <delete dir="${reports.dir}" />
    </target>

 </project>

Comments

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. wow really such a nice article here. I think now only i came to know some features or works. So please keep update like this.

    Digital Marketing For Small Business in Chennai

    ReplyDelete
  3. This blog is having the general information. Got a creative work and this is very different one.We have to develop our creativity mind.This blog helps for this. Thank you for this blog. This is very interesting and useful.

    Branding Services in Chennai

    ReplyDelete
  4. This technological concepts are really well being and wonderful thus it is very much interesting and very well good too, really i got more information from your knowledge.


    Digital Marketing services in Chennai

    ReplyDelete

  5. I am a regular reader of your blog. the blog is very interesting and will be much useful for us.
    Android training in chennai

    ReplyDelete
  6. your java related concepts thus it is really well done to a great job thus it is nice too and i got more information from your blog. i like this article and it is very well good too to practice the concepts.


    Best Informatica Training institute in chennai

    ReplyDelete
  7. This idea is mind blowing. I think everyone should know such information like you have described on this post. Thank you for sharing this explanation.Your final conclusion was good.

    Informatica Training in Chennai

    ReplyDelete
  8. Thanks for sharing article like this. The way you have stated everything above is quite awesome. Keep blogging like this. Thanks a lot.

    Best Dot Net Training Institutes in Chennai

    ReplyDelete
  9. Your technological concept is nice and i came to know about this process it is very well explained and also it is very likable to me. i like this concept.

    Best Laser Clinic In Chennai

    ReplyDelete
    Replies
    1. Java : http://www.metaforumtechnologies.com/java-j2ee-training-in-chennai.html
      Selenium : http://www.metaforumtechnologies.com/selenium-testing-training-in-chennai.html

      Delete
  10. this is really too useful and have more ideas from yours. keep sharing many techniques. eagerly waiting for your new blog and useful information. keep doing more.
    java training in chennai

    ReplyDelete
  11. Somebody necessarily help to make severely posts I might state. This is the first time I frequented your website page and to this point? I surprised with the research you made to create this particular post extraordinary. Well done admin..
    Back to original

    ReplyDelete
  12. Superb. I really enjoyed very much with this article here. Really it is an amazing article I had ever read. I hope it will help a lot for all. Thank you so much for this amazing posts and please keep update like this excellent article.thank you for sharing such a great blog with us. expecting for your.
    seo company in india

    ReplyDelete
  13. It’s amazing in support of me to have a site, which is useful in support of my know-how. thanks admin|, you surely come with remarkable articles. Cheers for sharing your website page.Excellent blog here...


    Tooth Braces In Chennai

    Dental Hospital in Chenna


    ReplyDelete
  14. nice post for sharing Java article. its really helpful for me. keep shring on updated tutorials????????????????

    ReplyDelete
  15. Interesting blog post.This blog shows that you have a great future as a content writer.waiting for more updates...
    Digital Marketing Company in India

    ReplyDelete
  16. I’ve been browsing on-line greater than three hours today, but I never discovered any attention-grabbing article like yours. It is beautiful worth

    sufficient for me. Personally, if all webmasters and bloggers made good content material as you did, the net will be a lot more helpful than ever before.
    cloud computing training in chennai


    ReplyDelete
  17. wow really superb you had posted one nice information through this. Definitely it will be useful for many people. So please keep update like this.

    Dental Clinic in Chennai
    Nobel Implants In Chennai
    Best Pediatric Dentist in Chennai
    Orthodontic Treatment

    ReplyDelete

Post a Comment