You can do with a tiny workaround:

define property that will be set once (in your "base" target)
then in the tas check to see if the property is set using the unless statment

<... unless="property.name"...>

</target>

Then you run it only once.

sample code:

<?xml version="1.0"?>
<project name="project" default="default">
    <property name="props.A" value="set value"/>

    <target name="default" depends="depends1,depends2" description="--> 
description">

    </target>

        <target name="depends1" unless="props.A">
            <echo message="props.A is set "/>
        </target>

        <target name="depends2" unless="props.B">
            <echo message="props.B is set "/>
        </target>

</project>


i have set the props.a
so it will not execute the corresponding target.

Nir.


-----Original Message-----
From: Uri Zeituni [mailto:[EMAIL PROTECTED]
Sent: Wednesday, October 12, 2005 10:38 AM
To: Ant User list (E-mail)
Subject: Avoid repeat of completed tasks


Hello all,
I have a few independent tasks each one creates a jar file and I execute each 
one by itself. Most of them depend on the same general jar tasks. 
The situation now is that I want to call all of them within an EAR task. I use 
<antcall> task to do that.
Every task calls the general task that it depends on, so I have a situation 
where a general task that everyone depends on is called a few times. It seems 
like a waste of time. 
Here is an example of the output (I highlighted the repeated dependant tasks):

buildTechCore:
     [echo] TechCore compiled successfully
     [echo] TechCore.jar created

buildAppCore:
     [echo] Application core resources copied
    [javac] Compiling 772 source files to C:\SCMBuild\classes\ApplicationCore
   [ejbjar] building ApplicationCore.jar with 796 files
     [echo] ApplicationCore.jar created
     [echo] Core projects created successfully

buildWFEngine:
    [javac] Compiling 78 source files to C:\SCMBuild\classes\Workflow
   [ejbjar] building SCMWorkFlowEngine.jar with 93 files

buildFE:
    [javac] Compiling 159 source files to C:\SCMBuild\classes\Frontend
     [echo] Frontend project compiled successfully
   [ejbjar] building SCMFWFrontEnd.jar with 165 files
     [echo] SCMFronend.jar created

buildWebModule:
     [echo] SCMWeb resources copied
     [echo] SCMWeb classes compiled successfully
     [echo] SCMWeb.war created

buildCommonApp:
    [javac] Compiling 409 source files to C:\SCMBuild\classes\CommonApp
   [ejbjar] building SCMCommonApplication.jar with 422 files

buildGDSN:
    [javac] Compiling 12 source files to C:\SCMBuild\classes\GDSN
   [ejbjar] building GDSN.jar with 31 files

buildTechCore:
     [echo] TechCore compiled successfully
     [echo] TechCore.jar created

buildAppCore:
     [echo] Application core resources copied
    [javac] Compiling 772 source files to C:\SCMBuild\classes\ApplicationCore
   [ejbjar] building ApplicationCore.jar with 796 files
     [echo] ApplicationCore.jar created
     [echo] Core projects created successfully

buildWFEngine:
    [javac] Compiling 78 source files to C:\SCMBuild\classes\Workflow
   [ejbjar] building SCMWorkFlowEngine.jar with 93 files

buildFE:
    [javac] Compiling 159 source files to C:\SCMBuild\classes\Frontend
     [echo] Frontend project compiled successfully
   [ejbjar] building SCMFWFrontEnd.jar with 165 files
     [echo] SCMFronend.jar created

buildWebModule:
     [echo] SCMWeb resources copied
     [echo] SCMWeb classes compiled successfully
     [echo] SCMWeb.war created

buildCommonApp:
    [javac] Compiling 409 source files to C:\SCMBuild\classes\CommonApp
   [ejbjar] building SCMCommonApplication.jar with 422 files

buildOMS:
    [javac] Compiling 224 source files to C:\SCMBuild\classes\OMS
   [ejbjar] building OMS.jar with 229 files

buildTechCore:
     [echo] TechCore compiled successfully
     [echo] TechCore.jar created

buildAppCore:
     [echo] Application core resources copied
    [javac] Compiling 772 source files to C:\SCMBuild\classes\ApplicationCore
   [ejbjar] building ApplicationCore.jar with 796 files
     [echo] ApplicationCore.jar created
     [echo] Core projects created successfully

buildWFEngine:
    [javac] Compiling 78 source files to C:\SCMBuild\classes\Workflow
   [ejbjar] building SCMWorkFlowEngine.jar with 93 files

buildFE:
    [javac] Compiling 159 source files to C:\SCMBuild\classes\Frontend
     [echo] Frontend project compiled successfully
   [ejbjar] building SCMFWFrontEnd.jar with 165 files
     [echo] SCMFronend.jar created

buildWebModule:
     [echo] SCMWeb resources copied
     [echo] SCMWeb classes compiled successfully
     [echo] SCMWeb.war created

buildCommonApp:
    [javac] Compiling 409 source files to C:\SCMBuild\classes\CommonApp
   [ejbjar] building SCMCommonApplication.jar with 422 files

and so on....

How can I avoid this situation, so the general tasks will not repeat themselves 
but will be executed only once?
Many thanks,
Zeituni

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to