I have local properties defined in a user.properties file
If that file is not there or the values are not defined, how can I stop the
build?

Here is an example of how I'm handling it.
thanx

user.properties:
XtendSoftPagesRoot=C:\\development\\ColdFusion\\xtendsoft
ColdFusionRoot=c:\\cfusion
WWWRoot=c:\\InetPub\\wwwroot

build.xml:
<?xml version="1.0"?>

<!--
======================================================================= -->
<!-- Build
     -->
<!--
======================================================================= -->

<!-- change the variables if this project gets moved -->

<project name="XtendSoft" default="getCurrent" basedir=".">

        <!--
====================================================================== -->
        <!-- The user must define these three variables where they are on              
         -->
        <!-- the local machine.  If not defined (when getting for the first
time)   -->
        <!-- all targets will be skipped. XtendSoftPagesRoot is where you
nt              -->
        <!-- your pages put     this is also where your IIS virtual dir /xtendsoft     
         -->
        <!-- should be pointing to                                                     
                                                 -->
        <!--
====================================================================== -->

        <!-- you must set the XtendSoftPagesRoot and ColdFusionRoot in this
ile     -->
        <!-- and call the file user.properties. It must be in the same dir as
the     -->
        <!-- master build file (build.xml)                                             
                                         -->

        <property file="user.properties"/>

     <!--<property name="XtendSoftPagesRoot"
value="${basedir}\ColdFusion\xtendsoft"/> -->
    <!-- ColdFusionRoot is where you Installed ColdFusion
                 The custom tags will be put here -->
        <!--<property name="ColdFusionRoot" value="c:\cfusion"/>-->
        <!-- WWWRoot is wher the inetput\wwwroot is
                 the classes will be put here -->
        <!--<property name="WWWRoot" value="c:\InetPub\wwwroot"/>-->

        <!-- ================================================================== -->
        <!-- send some info to the user           -->
        <!-- ================================================================== -->

        <target name="info">
                <antcall target="echoXtendSoftPagesRootTrue"/>
                <antcall target="echoXtendSoftPagesRootFalse"/>
                <antcall target="echoColdFusionRootTrue"/>
                <antcall target="echoColdFusionRootFalse"/>
                <antcall target="echoWWWRootTrue"/>
                <antcall target="echoWWWRootFalse"/>
        </target>

        <!-- ================================================================== -->
        <!-- do some checks to see if the variables have been defined           -->
        <!-- ================================================================== -->

        <target name="echoXtendSoftPagesRootTrue" if="XtendSoftPagesRoot">
                <echo message="XtendSoftPagesRoot=${XtendSoftPagesRoot}"/>
        </target>

        <target name="echoXtendSoftPagesRootFalse" unless="XtendSoftPagesRoot">
                <echo message="XtendSoftPagesRoot must be defined in a file called
user.properties"/>
        </target>

        <target name="echoColdFusionRootTrue" if="ColdFusionRoot">
                <echo message="ColdFusionRoot=${ColdFusionRoot}"/>
        </target>

        <target name="echoColdFusionRootFalse" unless="ColdFusionRoot">
                <echo message="ColdFusionRoot must be defined in a file called
user.properties"/>
        </target>

        <target name="echoWWWRootTrue" if="WWWRoot">
                <echo message="WWWRoot=${WWWRoot}"/>
        </target>

        <target name="echoWWWRootFalse" unless="WWWRoot">
                <echo message="WWWRoot must be defined in a file called 
user.properties"/>
        </target>
        <!-- ================================================================== -->
        <!-- make some directories                            -->
        <!-- ================================================================== -->


        <target name="getCurrent" depends="getCustomTags,getPages,getClasses"
description="get the current build from">
                <andcall name="XtendTree"/>
        </target>


        <target name="XtendTree">
                <ant dir="${basedir}/java/XtendTree" />
                <copy file="${basedir}/java/XtendTree/deploy/XtendTree-1.0.0.jar"
toFile="${WWWRoot}/classes/XtendTree.jar"/>

        </target>
        <!-- ================================================================== -->
        <!-- get the stuff from vss -->
        <!-- ================================================================== -->

        <target name="getCustomTags" depends="info" if="ColdFusionRoot">
                <echo message="Getting Coldfusion specific code to ${ColdFusionRoot}"/>
                <vssget localPath="${ColdFusionRoot}"
                        recursive="true"
                        vsspath="/xtendsoft/CFUSION"
                        ssdir="\\Xtend-devdb\D_Drive\Program Files\Microsoft Visual
Studio\VSS\win32"
                        writable="false"/>
        </target>
        <target name="getPages" depends="makePagesDir, info"
if="XtendSoftPagesRoot">
                <echo message="Getting XtendSoft Pages specific code to
${XtendSoftPagesRoot}"/>
                <vssget localPath="${XtendSoftPagesRoot}"
                                recursive="true"
                        vsspath="/xtendsoft/XtendSoftPages"
                        ssdir="\\Xtend-devdb\D_Drive\Program Files\Microsoft Visual
Studio\VSS\win32"
                        writable="false"/>
        </target>
        <target name="getClasses" depends="info" if="WWWRoot">
                <echo message="Getting Java Classes specific code to ${WWWRoot}"/>

                <vssget localPath="${WWWRoot}"
                        recursive="true"
                        vsspath="/xtendsoft/WWWROOT"
                        ssdir="\\Xtend-devdb\D_Drive\Program Files\Microsoft Visual
Studio\VSS\win32"
                        writable="false"/>
        </target>

        <target name="makePagesDir">
                <mkdir dir="${XtendSoftPagesRoot}"/>
        </target>
        <!-- ================================================================== -->
        <!-- clean up -->
        <!-- ================================================================== -->

        <target name="clean">
                <echo message="Delete directory ${XtendSoftPagesRoot}"/>
                <delete dir="${XtendSoftPagesRoot}"/>
        </target>
</project>

Joe Fisher, Software Developer
Xtend Inc.
http://www.xtendsoft.com
voice  801.825.5553 ext 309
fax    801.825.5606
e-mail [EMAIL PROTECTED]
s-mail 1645 East Hwy 193, Suite 202
       Layton, Ut 84041


Reply via email to