ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Kailash.Subraman...@alltel.com
Subject Newbie question about if/then/else
Date Sat, 20 Apr 2002 03:29:28 GMT

All,
     This is what I want to do.

Assuming I 've a properties file as follows.

COMP=
VIEW=
TM_VIEW=system_TM_1.0_integration
SHARED_VIEW=system_SHARED_1.0_integration
CF_VIEW=system_CF_1.0_integration

     I want to supply two values in the command line parameter, like ant
-DVIEW=system_TM_1.0_integration -DCOMP=COMP_TM, and based on that I want
to do the following

<target name="jar" >
     <jar jarfile="/view/${VIEW}/${ROOT_DIR}/${COMP}/${COMP}.jar">
     <fileset dir="/view/${VIEW}/${ROOT_DIR}/${COMP}">
     <include name="**/*.class"/>
     </fileset>
     </jar>

     Here, I need to copy a file from a directory using each variable defined in the properties
file. Out of these variables one variable is used in
the above target "jar"
and I  want to copy from a different path for that variable alone but the rest from the path
which has similar pattern. I want to check for the jar
file created in the "jar" target
above and copy that jar for that varibale alone and for the rest copy the files as instructed
below.

For example, in this case,

     <copy file="${system_TM_1.0_integration}/file" todir="
${CODE_BASE}../"/> --------------> I don't want to copy here and skip this
     <copy file="${system_SHARED_1.0_integration}/file" todir="
${CODE_BASE}../"/>
     <copy file="${system_CF_1.0_integration}/file" todir="
${CODE_BASE}../"/>

One thing I thought of is using the <available> to check for the jar file
created in jar target and call some three targets to do the copy, by
skipping the one I want to. But, something tells me there might be a easy
way. Infact, I 've some 6 variables which are used in this copy business.
I guess, what I need here is something like,

<if>
     <fileavailable >
<then>
     <copythis>
<else>
     <copythis>
and do this for every copy task, I have.

I would appreciate any help with this. If this is not a good idea, I am
open for any suggestion. If I didn't make this clear, please let me know. I
will try to explain better.

Thanks in advance.

Kailash













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


Mime
View raw message