Thanks for your reply and help Jan, I'm still not clear.
All 3 files have to be copied to 3 different subfolders.
So file1.qa, file2.qa, and file3.qa or with .staging extension would be fine as
long as I'm building for those 2 environment. But when it comes to production
I have to copy, say, file1.prod.uk (sometimes prod.us, etc) and file2.prod and
file3.prod to different folders for the production build, I don't see how
${selected} could possess 2 values simutaneously (prod and prod.uk) in your
example. Am I missing something or did I minunderstand? Please
<property name="selected" value="qa" description="Default is doing QA"/>
<copy todir="some/dir">
<fileset dir="properties" includesfile="includes.${selected}"/>
</copy>
$ant -Dselected=qa
+++++++++++++++++++++++++++++++++++++++++++++++++
> Subject: AW: Help With Condition Task
> Date: Fri, 30 Oct 2009 06:53:24 +0100
> From: [email protected]
> To: [email protected]
>
> An idea is not to reference the files instead of "including" them:
>
> file ./includes.qa:
> ---8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<----
> file1.qa
> file2.qa
> file3.qa
> ---8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<----
>
>
> file ./includes.staging
> ---8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<----
> file*.staging
> ---8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<-------8-<----
>
>
> file ./includes...
>
>
>
> <property name="selected" value="qa" description="Default is doing QA"/>
> <copy todir="some/dir">
> <fileset dir="properties" includesfile="includes.${selected}"/>
> </copy>
>
> $ant -Dselected=qa
>
>
>
> Jan
>
> >-----Ursprüngliche Nachricht-----
> >Von: Rez P [mailto:[email protected]]
> >Gesendet: Freitag, 30. Oktober 2009 05:46
> >An: Ant
> >Betreff: Help With Condition Task
> >
> >
> >Hi
> >
> >I need help for what I need to do and not sure how to do it.
> >I have bunch of property files with different extensions,
> >file1.{qa,staging,prod.uk,prod.us,prod.nz} and
> >file2.{qa,staging,prod} and file3.{qa,staging,prod}.
> >
> >I need to have the copy task copy the correct respective
> >environmental file to certain directories before I do my compile.
> >
> >Here's a sample of my copy
> >
> >target init
> ><copy file="properties/file1.${ext1}" todir="some/dir" />
> ><copy file="properties/file2.${ext1}" todir="some/dir" />
> ><copy file="properties/file3.${ext1}" todir="some/dir" />
> >
> >
> >c:\project>ant -Dext1=qa init
> >
> >since all 3 files have qa & staging in common, it runs
> >successfully but not sure how I can declare ext1 to be 2
> >things at the same time, meaning "ant -Dext1=prod.uk init"
> >will fail because the other 2 files have no such extensions
> >and adversely "ant -Dext1=prod init" will fail because not all
> >files have prod extension.
> >
> >I would like to try something like
> >
> >c:\project>ant -Dext1=prod.uk -Dext2=prod init
> >
> >and maybe set up a condition in the ant file in target init if
> >ext1 or ext2 equal certain value do this or do this other
> >thing. I am reading the help page on Apache Ant and I don't
> >see any thorough or detailed examples and the page doesn't
> >really cover much of a description.
> >
> >Thanks
> >
> >Rez
> >
> >_________________________________________________________________
> >Windows 7: It works the way you want. Learn more.
> >http://www.microsoft.com/Windows/windows-7/default.aspx?ocid=PI
> D24727::T:WLMTAGL:ON:WL:en-US:WWL_WIN_evergreen2:102009
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
_________________________________________________________________
New Windows 7: Find the right PC for you. Learn more.
http://www.microsoft.com/windows/pc-scout/default.aspx?CBID=wl&ocid=PID24727::T:WLMTAGL:ON:WL:en-US:WWL_WIN_pcscout:102009