You may need to specifically test against "true"

    <j:if test="${junitejb.test.jar.available == 'true'}">
        ..... do something
    </j:if>

there's some funny things that happen too, if you do something on the
command line such as:

maven somegoal -Dvar

without setting it to anything, that "var" will have a value of "true" in
it.

I always look to the source for these kinds of things.  Look at the various
plugin.jelly files in your repository for hints on using this kind of stuff.



----- Original Message ----- 
From: "Nathan Coast" <[EMAIL PROTECTED]>
To: "Maven Users" <[EMAIL PROTECTED]>
Sent: Saturday, September 20, 2003 3:48 AM
Subject: available tag within loop


> Hi,
>
> Apologies if this is a duplicate, I think I posted this yesterday but it
> doesn't seem to have reached the list.
>
> I'm having problems using ant:available within a loop.
>
> <j:forEach var="lib" items="${pom.artifacts}">
>     <j:set var="dep" value="${lib.dependency}"/>
>     <j:set var="junitejb.test.jar"
>            value="foo.bar.${dep.getArtifactId()}.jar"/>
>
>     <ant:available property="junitejb.test.jar.available"
>                    file="${junitejb.test.jar}"/>
>
>     <j:if test="${junitejb.test.jar.available}">
>         ..... do something
>     </j:if>
>     <j:set var="junitejb.test.jar.available" value=""/>
> </j:forEach>
>
> If the available test fails to locate the file, the value of the
> property is unchanged.  So when a file is located, all subsequent loops
> the property junitejb.test.jar.available is true.
>
> I tried resetting the property to "" but then the var doesn't seem to
> get set to true if a file is located in subsequent loops.
>
> cheers
> Nathan
>
>
> ---------------------------------------------------------------------
> 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]

Reply via email to