thought I was going insane for a while there. quotes are only passed if your arg contains a space char!!!!!!!!!!!!!!!!!!!!!!!!!
how many hours did that take me to track down.
<exec executable="bin\test.bat">
<arg line='"hello world;test_this"'/>
</exec>
<exec executable="bin\test.bat">
<arg line='"hello_world;test_this"'/>
</exec>
produces this output
[exec] arg1 is #"hello world;test_this"#
[exec] arg2 is ##
[exec] arg1 is #hello_world#
[exec] arg2 is #test_this#
which is why this arg didn't have quotes in my case
<arg
line='"D:\projects\coffeebreak-common\target\coffeebreak-common-1.0.jar;target\classes"'/>
Ok I have a work around - put a space at the end. Is this a bug?
thanks for your help, wouldn't have found this if you hadn't shown me some code
proving you could put a quote in an arg
Nathan
Geoff Meakin wrote:
> Hmm.. works for me- see attached zip file
> Maybe you have an old version of ANT? Im using ANT1.4.1
>
> -Geoff
>
> <<OUTPUT>>
>
> main:
> [exec] Current OS is Windows 2000
> [exec] bin\test.bat "hello world"
> Execute:Java13CommandLauncher: bin\test.bat "hello world"
> [exec] arg1 is #"hello world"#
>
>
> -----Original Message-----
> From: Nathan Coast [mailto:[EMAIL PROTECTED]]
> Sent: 29 July 2002 05:51 PM
> To: Ant Users List
> Subject: Re: quotes in args for exec
>
>
> Hi,
>
> thanks, yes I had seen your first comment and I can confirm that the mix of
> both
> relative and absolute paths is correct. my original build file contained a
> set
> of properties (no hard coded values). In order to debug the problem I
> started
> by successfully executing the command outstide ant. I then replaced the
> values
> in build.xml with the values which worked correctly from cmd. But to my
> suprise
> ant failed. I believe the 'classpath' argument is in this case a red
> herring.
> It is not the classpath for the underlying java executable but it is a
> parameter
> needed by the executable. When this parameter contains more than one
> section
> delimited by a ';' the value of the parameter needs to be quoted. The
> relative
> paths are fine as they are relative to the where I am executing ant from.
> (btw,
> I have tried with dir set and with absolute paths for all of the parameters
> with
> the same error.)
>
> I need to execute this
>
> D:\java\jwsdp-1_0\bin\xrpcc.bat -server -classpath
> "D:\projects\coffeebreak-common\target\coffeebreak-common-1.0.jar;target\cla
> sses"
> -d target\classes conf\config.xml
>
> but ant is giving me this
>
> D:\java\jwsdp-1_0\bin\xrpcc.bat -server -classpath
> D:\projects\coffeebreak-common\target\coffeebreak-common-1.0.jar;target\clas
> ses
> -d target\classes conf\config.xml
>
> If I execute this line on cmd I get the same error as I am getting when I
> run
> from witin ant.
>
> If you have any idea how to pass quotes within the arg I'd be grateful.
>
> (note the missing quotes)
> Geoff Meakin wrote:
>
>>2 things
>>
>>1st see my mail from before regarding dir if you havent seen it yet. This
>
> is
>
>>probably a cause why
>>things arent working from ANT
>>
>>2nd you can use line='"blah"' if you want to (i.e. single quotes for XML
>
> and
>
>>embedding normal quotes
>>in them), though as far as I know " is also a valid syntax, so this
>>leads me to suspect
>>the first point instead.
>>
>>Cheers
>>-Geoff
>>
>>
>>-----Original Message-----
>>From: Nathan Coast [mailto:[EMAIL PROTECTED]]
>>Sent: 29 July 2002 04:57 PM
>>To: Ant Users List
>>Subject: quotes in args for exec
>>
>>
>>Hi,
>>
>>I need to get quotes in arguments to an exec command. In order for the
>>command
>>to work, the -classpath argument needs to be in quotes. Don't ask me why,
>>it
>>just does :)
>>
>>this is what I have in my build.xml
>>
>> <exec executable="D:\java\jwsdp-1_0\bin\xrpcc.bat">
>> <arg line="-server" />
>> <arg line="-classpath
>>
>
> "D:\projects\coffeebreak-common\target\coffeebreak-common-1.0.jar;targe
>
>>t\classes""/>
>> <arg line="-d target\classes" />
>> <arg line="conf\config.xml" />
>> </exec>
>>
>>but as you can see from the debug, the quotes are missing from executed
>>command.
>>
>>[exec] [DEBUG] Execute:Java13CommandLauncher:
>>D:\java\jwsdp-1_0\bin\xrpcc.bat
>>-server -classpath
>>D:\projects\coffeebreak-common\target\coffeebreak-common-1.
>>0.jar;target\classes -d target\classes conf\config.xml
>>
>>if I run the exact command above with quotes from cmd, everything works
>>fine.
>>
>>thanks
>>Nathan
>>
>>
>>--
>>To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
>>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>>
>>
>>
>>--
>>To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
>>For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>>
>>
>
>
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
>
>
> ------------------------------------------------------------------------
>
> --
> To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
test.zip
Description: Zip compressed data
-- To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]> For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
