ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <vinod.na...@iflexsolutions.com>
Subject RE: Problem to set property with refid
Date Thu, 03 Jun 2004 09:32:53 GMT
Thanks Ivan,

I used the logic 'isset' and my problem is solved.

Tell me, am I correct here.

<javac destdir="${build}"
         classpath="xyz.jar"
         debug="on">
    <src path="${src1}"/>
    <src path="${src2}"/>
</javac>

In this task, java source files of ${src1} are compiled first and then
later from ${src2}. I tested it by having a java file in ${src2}
dependent on a java file existing in ${src1} and it could compile
successfully. But while compiling the task echoes, 'compiling <no of
files from ${src1}+ no of files from ${src2} java file to ..' in a
single line. I want to be double sure on what I am guessing is right.

Please help me,
Vinod.


-----Original Message-----
From: Ivan Ivanov [mailto:rambiusparkisanius@yahoo.com] 
Sent: Thursday, June 03, 2004 12:53 PM
To: Ant Users List
Subject: RE: Problem to set property with refid

Hi Vinod,

Let's say the property we want to check is called
testprop. The check can be done in several ways

1) Pure Ant
<target name="main" depends="target_A, target_B"/>

<target name="target_A" if="testprop">
... Do smth here
</target>

<target name="target_B" unless="testprop">
... Do smth here again
</target>

The point is that target "main" will call both
target_A and target_B. Then if testprop IS set
target_A will be excecuted. If testprop IS NOT set
target_B will be executed.

2) Ant + Ant-Contrib
If you have many conditions to check in this way you
may prefer ant-contrib [1] <if> task [2]. In our case:
<target name="main">
    <if>
        <isset property="testprop">
        <then>
            ... Do here the stuff previously done in
target_A
        </then>
        <else>
            ... Do here the stuff previously done in
target_B
        </else>
    </if>
</target>

Note that <isset> is Ant built-in condition. For more
info on condition check [3] and [4].

Regards Ivan

[1]http://ant-contrib.sourceforge.net/
[2]http://ant-contrib.sourceforge.net/tasks/if.html
[3]http://ant.apache.org/manual/CoreTasks/condition.html
[4]http://ant.apache.org/manual/CoreTasks/conditions.html


	
		
__________________________________
Do you Yahoo!?
Friends.  Fun.  Try the all-new Yahoo! Messenger.
http://messenger.yahoo.com/ 

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Mime
View raw message