ant-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Claudio Corsi <cco...@progress.com>
Subject Re: more than one unless/if in a target
Date Wed, 06 Aug 2003 18:03:52 GMT
Vikas Phonsa wrote:
> Hi Folks,
> 
> Can we use more than one "unless" or "if" in a target. I mean if I need to
> check unless for more than one property.

Vikas,

Since this is xml and it seems to me that the build xml file needs to be 
well-form w.r.t. ant. You should not be allowed to include multiple 
instances of the unless and/or if attribute in the target element.

I would then suggest that when you need to consider multiple unless 
and/or if conditions to be checked. You should use the condition element 
to create a new property that is used to evaluate all of the different 
properties that you need to compare.

For examples, you need to include a unless="name1" and unless="name2", 
you can use the condition element to create a new property name1name2 
such that you do the following:

    <condition property="name1name2">
      <and>
       <evaluation of name1 property>
       <evaluation of name2 property>
      <and>
    </condition>

--Claudio

> 
> Vikas
> 
> -----Original Message-----
> From: Philippe Waltregny [mailto:philippe.waltregny@nrb.be] 
> Sent: Wednesday, August 06, 2003 4:48 AM
> To: user@ant.apache.org
> Subject: How to use the Ant task <input> within WSAD 5?
> 
> Hello,
>  

IMHO, It seems to me that the default input handler is not using the 
right input stream associated with WASD. This might actually be a bug or 
WSAD is doing something that is non-standard.

> I would like to execute successfully the following Ant build file both
> from WSAD 5 and outside (Command Prompt). I've upgraded the Ant version
> from 1.4.1 to 1.5.1 within WSAD to support the Ant task <input>.
>  
> <?xml version="1.0" encoding="ISO-8859-1"?>
> <project
>       name="input"
>       default="init"
>       basedir=".">
>  
>       <target name="init">
>             <!-- Display the Ant version -->
>             <echo message="Ant version = ${ant.version}" />
>             <!-- Enter something -->
>             <input
>                   message="Please enter something:"
>                   addproperty="user.input" />
>             <!-- Display the user's input -->
>             <echo message="user.input = ${user.input}" />
>       </target>
>  
> </project>
>  
>  
> So far, I've different results :
>  
> In WSAD 5
>  
>                         parsing buildfile
> C:\Backup\WSAD5_Workspace1\workspace\AntJ2EE\xml\input.xml with URI =
> file:C:/Backup/WSAD5_Workspace1/workspace/AntJ2EE/xml/input.xml
> Project base dir set to:
> C:\Backup\WSAD5_Workspace1\workspace\AntJ2EE\xml
> Arguments: -verbose
> Build sequence for target `init' is [init]
> Complete build sequence is [init]
> Ant version = Ant version 1.5.1 compiled on October 2 2002
> Please enter something:
> Build exception:
> file:C:/Backup/WSAD5_Workspace1/workspace/AntJ2EE/xml/input.xml:13:
> Failed to read input from Console.
> Build exception:
> file:C:/Backup/WSAD5_Workspace1/workspace/AntJ2EE/xml/input.xml:13:
> Failed to read input from Console.
> file:C:/Backup/WSAD5_Workspace1/workspace/AntJ2EE/xml/input.xml:13:
> Failed to read input from Console.
>                 at
> org.apache.tools.ant.input.DefaultInputHandler.handleInput(DefaultInputH
> andler.java:94)
>                 at
> org.apache.tools.ant.taskdefs.Input.execute(Input.java:138)
>                 at org.apache.tools.ant.Task.perform(Task.java:319)
>                 at org.apache.tools.ant.Target.execute(Target.java:309)
>                 at
> org.apache.tools.ant.Target.performTasks(Target.java:336)
>                 at
> org.apache.tools.ant.Project.executeTarget(Project.java:1306)
>                 at
> org.apache.tools.ant.Project.executeTargets(Project.java:1250)
>                 at
> org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunne
> r.java:262)
>                 at java.lang.reflect.Method.invoke(Native Method)
>                 at
> org.eclipse.ant.core.AntRunner.run(AntRunner.java:234)
>                 at
> org.eclipse.ui.externaltools.internal.core.AntFileRunner.execute(AntFile
> Runner.java:56)
>                 at
> org.eclipse.ui.externaltools.internal.core.DefaultRunnerContext.executeR
> unner(DefaultRunnerContext.java:428)
>                 at
> org.eclipse.ui.externaltools.internal.core.DefaultRunnerContext.run(Defa
> ultRunnerContext.java:479)
>                 at
> org.eclipse.ui.externaltools.internal.ui.AntLaunchWizard$1.run(AntLaunch
> Wizard.java:117)
>                 at
> org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalCon
> text.java:98)
> --- Nested Exception ---
> java.io.IOException: The handle is invalid
>                 at java.io.FileInputStream.readBytes(Native Method)
>                 at
> java.io.FileInputStream.read(FileInputStream.java(Compiled Code))
>                 at
> java.io.BufferedInputStream.read1(BufferedInputStream.java(Compiled
> Code))
>                 at
> java.io.BufferedInputStream.read(BufferedInputStream.java(Compiled
> Code))
>                 at
> java.io.FilterInputStream.read(FilterInputStream.java(Compiled Code))
>                 at
> java.io.InputStreamReader.fill(InputStreamReader.java(Compiled Code))
>                 at
> java.io.InputStreamReader.read(InputStreamReader.java(Compiled Code))
>                 at
> java.io.BufferedReader.fill(BufferedReader.java(Compiled Code))
>                 at
> java.io.BufferedReader.readLine(BufferedReader.java(Compiled Code))
>                 at
> java.io.BufferedReader.readLine(BufferedReader.java:378)
>                 at
> org.apache.tools.ant.input.DefaultInputHandler.handleInput(DefaultInputH
> andler.java:91)
>                 at
> org.apache.tools.ant.taskdefs.Input.execute(Input.java:138)
>                 at org.apache.tools.ant.Task.perform(Task.java:319)
>                 at org.apache.tools.ant.Target.execute(Target.java:309)
>                 at
> org.apache.tools.ant.Target.performTasks(Target.java:336)
>                 at
> org.apache.tools.ant.Project.executeTarget(Project.java:1306)
>                 at
> org.apache.tools.ant.Project.executeTargets(Project.java:1250)
>                 at
> org.eclipse.ant.internal.core.ant.InternalAntRunner.run(InternalAntRunne
> r.java:262)
>                 at java.lang.reflect.Method.invoke(Native Method)
>                 at
> org.eclipse.ant.core.AntRunner.run(AntRunner.java:234)
>                 at
> org.eclipse.ui.externaltools.internal.core.AntFileRunner.execute(AntFile
> Runner.java:56)
>                 at
> org.eclipse.ui.externaltools.internal.core.DefaultRunnerContext.executeR
> unner(DefaultRunnerContext.java:428)
>                 at
> org.eclipse.ui.externaltools.internal.core.DefaultRunnerContext.run(Defa
> ultRunnerContext.java:479)
>                 at
> org.eclipse.ui.externaltools.internal.ui.AntLaunchWizard$1.run(AntLaunch
> Wizard.java:117)
>                 at
> org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalCon
> text.java:98)
> Build exception:
> file:C:/Backup/WSAD5_Workspace1/workspace/AntJ2EE/xml/input.xml:13:
> Failed to read input from Console.
>  
>             In a Command Prompt
>  
>             C:\Backup\WSAD5_Workspace1\workspace\AntJ2EE\xml>ant -f
> input.xml
> Buildfile: input.xml
>  
> init:
>      [echo] Ant version = Apache Ant version 1.5.1 compiled on October 2
> 2002
>     [input] Please enter something:
> aaaa
>      [echo] user.input = aaaa
>  
> BUILD SUCCESSFUL
> Total time: 2 seconds
> C:\Backup\WSAD5_Workspace1\workspace\AntJ2EE\xml>
>  
> How to allow the <input> usage with WSAD 5 ?
>  
> Greetings.
>  
>  
> Philippe Waltregny
>  mailto:philippe.waltregny@nrb.be
>  
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
> 



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


Mime
View raw message