ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jan Matèrne <apa...@materne.de>
Subject AW: How to fail if property expansion failed...
Date Fri, 22 Oct 2010 08:31:36 GMT
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:mattf64@hotmail.com]
> Gesendet: Freitag, 22. Oktober 2010 01:49
> An: dev@ant.apache.org
> 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: dev-unsubscribe@ant.apache.org
> For additional commands, e-mail: dev-help@ant.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message