Nathan Coast <[EMAIL PROTECTED]> wrote on 20/09/2003 08:48:04 PM:
> 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.
Note the 'ant' on the front of that. All ant properties, once set are
immutable.
>
> <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.
Don't use it. Look at util:available in the jelly util tag lib.
And core:break.
--
dIon Gillard, Multitask Consulting
Blog: http://blogs.codehaus.org/people/dion/
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]