declaring the xmlns like <project xmlns:ac="antlib:net.sf.antcontrib"> and having the jar on the classpath (-lib option)
and you could use the tasks directly without any taskdef. Jan >-----Ursprüngliche Nachricht----- >Von: Scot P. Floess [mailto:[EMAIL PROTECTED] >Gesendet: Donnerstag, 13. November 2008 16:07 >An: Patrick Waugh >Cc: Ant Users List >Betreff: Re: Optional <entry/> if and only if properties file exists? > > >Its a namespace thing you define at the top of your >build.xml... Mine is >usually > >xmlns:ant-contrib = "http://ant-contrib.sourceforge.net" > >Thereby making if for me: > ><ant-contrib:if> > >On Thu, 13 Nov 2008, Patrick Waugh wrote: > >> Interesting. <if> works for me, but not <ac:if> >> >> Patrick >> >> On Thu, Nov 13, 2008 at 8:59 AM, Scot P. Floess ><[EMAIL PROTECTED]> wrote: >>> >>> ac is the namespace for Ant Contrib, if - thats the Ant >Contrib task if >>> >>> >>> >>> >>> On Thu, 13 Nov 2008, Patrick Waugh wrote: >>> >>>> What is <ac:if> ????? >>>> >>>> On Thu, Nov 13, 2008 at 7:04 AM, ><[EMAIL PROTECTED]> wrote: >>>>>>> >>>>>>> <target name="checkprops"> >>>>>>> <condition property="propfileexists"> >>>>>>> <available file="path/to/your/propsfile"/> >>>>>>> </condition> >>>>>>> ... >>>>>>> </target> >>>>>>> >>>>>>> >>>>>>> <target name="foobar" depends="checkprops" >unless="propfileexists"> >>>>>>> <my.rapc/> >>>>>>> <target> >>>>>>> >>>>>>> <target name="foobaz" depends="checkprops" if="propfileexists"> >>>>>>> <my.rapc> >>>>>>> <entry file="entryGUI.properties" /> >>>>>>> </my.rapc> >>>>>>> <target> >>>>>>> >>>>>>> >>>>>>> or check the condition with antcontrib if/else in one target >>>>>>> >>>>>>> <target .... >>>>>>> <if> >>>>>>> <available file="path/to/your/propsfile"/> >>>>>>> <then> >>>>>>> <my.rapc> >>>>>>> <entry file="entryGUI.properties" /> >>>>>>> </my.rapc> >>>>>>> </then> >>>>>>> <else> >>>>>>> <my.rapc/> >>>>>>> </else> >>>>>>> </if> >>>>>>> </target >>>>> >>>>> I would use the ac:if inside the makro. >>>>> >>>>> <macrodef name="my.rapc"> >>>>> <attribute name="entryfile" default="--not-available-file--"/> >>>>> <attribute name="output" default="${cod.name}"/> >>>>> <attribute name="srcdir" default="${src.dir}"/> >>>>> <attribute name="destdir" default="${build.dir}"/> >>>>> <attribute name="jdp" default="project.properties"/> >>>>> <element name="inside-rapc" implicit="true"/> >>>>> <sequential> >>>>> <ac:if> >>>>> <available file="@{propfile}"/> >>>>> <then> >>>>> <rapc output="@{output}" srcdir="@{srcdir}" >>>>> destdir="@{destdir}"> >>>>> <jdp file="@{jdp}"> >>>>> <entry file="@{entryfile}" /> >>>>> </jdp> >>>>> <inside-rapc/> >>>>> </rapc> >>>>> </then> >>>>> <then> >>>>> <rapc output="${cod.name}" srcdir="${src.dir}" >>>>> destdir="${build.dir}"> >>>>> <jdp file="project.properties"/> >>>>> <inside-rapc/> >>>>> </rapc> >>>>> </then> >>>>> </ac:if> >>>>> </sequential> >>>>> </macrodef> >>>>> >>>>> >>>>> >>>>> <my.rapc/> >>>>> <my.rapc entryfile="entryGUI.properties"/> >>>>> <my.rapc outdir="other-outdir"/> >>>>> <my.rapc> >>>>> <snip/> >>>>> <snip/> >>>>> <snip/> >>>>> </my.rapc> >>>>> >>>>> >>>>> >>>>> >>>>> Jan >>>>> >>>>> >>>>> >--------------------------------------------------------------------- >>>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>>> >>>>> >>>> >>>> >--------------------------------------------------------------------- >>>> To unsubscribe, e-mail: [EMAIL PROTECTED] >>>> For additional commands, e-mail: [EMAIL PROTECTED] >>>> >>>> >>> >>> Scot P. Floess >>> 27 Lake Royale >>> Louisburg, NC 27549 >>> >>> 252-478-8087 (Home) >>> 919-754-4592 (Work) >>> >>> Chief Architect JPlate http://sourceforge.net/projects/jplate >>> Chief Architect JavaPIM http://sourceforge.net/projects/javapim >>> >>> Architect Keros http://sourceforge.net/projects/keros >>> >> >> --------------------------------------------------------------------- >> To unsubscribe, e-mail: [EMAIL PROTECTED] >> For additional commands, e-mail: [EMAIL PROTECTED] >> >> > >Scot P. Floess >27 Lake Royale >Louisburg, NC 27549 > >252-478-8087 (Home) >919-754-4592 (Work) > >Chief Architect JPlate http://sourceforge.net/projects/jplate >Chief Architect JavaPIM http://sourceforge.net/projects/javapim > >Architect Keros http://sourceforge.net/projects/keros > >--------------------------------------------------------------------- >To unsubscribe, e-mail: [EMAIL PROTECTED] >For additional commands, e-mail: [EMAIL PROTECTED] > > --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
