Roland Müller wrote:
> ...
> I call "nant -D:customer=FladDemo"!
>
> I have now this solution for lowering:
>
> <property name="customer" value="FladDevelopment"/>
> <if test="${customer != ''}">
>     <property name="customer" value="${string::to-lower(customer)}"/>
> </if>
>
> This works.
> But I am looking for a single task where i can do this in one line. Or 
> how can i set a property with a default property and overwrite it in the 
> same task with the value from the command line?
>   
First, properties passed on the command line are read-only, so you can't 
change them.  Your first property task will fail if you pass customer on 
the command line.

The way around that is to use a naming convention to distinguish 
properties from the command line from the properties that you'll use in 
the rest of the script.  For example, use customer for the property on 
the command line, and customer.value everywhere else.

So, you could write:
  <property name="customer.value" value="FladDevelopment" />
  <property name="customer.value" value="${string::to-lower(customer)}" 
if="${customer != ''}" />

though I think you're better off with

  <property name="customer.value" value="fladdevelopment" />
  <property name="customer.value" value="${string::to-lower(customer)}" 
if="${property::exists('customer')}" />

because the user could write something like -D:customer=''

Gary


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
NAnt-users mailing list
NAnt-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nant-users

Reply via email to