25 Ağustos 2011 Perşembe

how to continue build with ant despite failure

I am aware of two ways to continue build process despite failure.. The first way is the easy one.. If the task that may fail has failonerror property, simply set it to false. However, not all tasks have that property. In those situations, subant task( http://ant.apache.org/manual/Tasks/subant.html) which is generally used for batch builds come into play. In order to use subant, you have to redesign your build file by moving targets which may-fail during build process in seperate build files. The target names that will be executed wihin subant in main build.xml must be identical..

Here is a subant example:


<subant failonerror="false">
            <fileset dir="." includes="**/build.xml" excludes="build.xml"/>
            <target name="clean"/>
            <target name="build"/>
        </subant>

By the way, if the execution order is important, filelist must be used instead of fileset as follows:


<subant failonerror="false">
<filelist dir="${parent.dir}">
    <file name="project1/build.xml"/>
    <file name="project2/bıild.xml"/>
    ...
    <file name="projectn/build.xml"/>
  </filelist>
            <target name="clean"/>
            <target name="build"/>
        </subant>




Hiç yorum yok:

Yorum Gönder