Ok, after searching for the perl map function this is what I understand:
- you have defined a list of libraries (@classpath) which you require
- you want to fail if one of these libs is missing
Simply I would define a list (comma separated or one-per-line) and iterate
with antcontrib:for.
<ac:for param="lib" list="${required.libs}">
<sequential>
<fail message="@{lib} missing"><not><available .../>
(not checked deeper ;-)
But instead of defining a list of jars you _want_ to have, why not define a
list and let the build system (more precisely the dependency manager) _get_
this list?
With Ivy
- define the "list" in ivy.xml
- use the Ivy Ant tasks (ivy:cachepath, ...) for creating a path with these
defined libs (and downloading them if needed)
Jan
> -----Ursprüngliche Nachricht-----
> Von: mattf [mailto:[email protected]]
> Gesendet: Freitag, 22. Oktober 2010 01:49
> An: [email protected]
> Betreff: How to fail if property expansion failed...
>
>
> In perl I would say:
>
> map {
> die "missing library $1" if /\$\{libs\.(.+)\.classpath\}/
> } @classpath;
>
>
> and get the feature that if property expansion failed, the build would
> halt
> with a meaningful error message.
>
> In ant:
>
> <filterchain>
> <expandproperties/># doesn't support failonerror attribute
> </filterchain>
>
> <fail message="missing library ${missing.library}">
> <condition property="missing.library"> # doesn't support property
> attribute
> <matches pattern="libs\.(.+)\.classpath"
> string="${libs.list.classpath}"/> # doesn't support property attribute
> </condition>
> </fail>
>
> <path path="${classpath}">
> <existing/> # does not fail if unset pathelement
> </path>
>
> How can I fail cleanly if the classpath could not be loaded?
>
> Is this item helpful? yes no Previous votes Yes: 0 No: 0
>
> --
> View this message in context: http://ant.1045680.n5.nabble.com/How-to-
> fail-if-property-expansion-failed-tp3231557p3231557.html
> Sent from the Ant - Dev mailing list archive at Nabble.com.
>
> ---------------------------------------------------------------------
> 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]