You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Vivek Payala <vi...@persistent.co.in> on 2008/09/29 16:07:32 UTC

Build fails when 'java' task's "arg line" contains a directory path with spaces

Hello,

 

Our build fails while executing the following task. It fails only when the
application is installed in a directory having space.

 

<java classname="com.abc.a" failonerror="true" fork="yes" maxmemory="512m"
errorproperty="runerror">

            <jvmarg value="-server"/>

            <arg line="@{type} @{configDir}"/>

            <classpath>

             <path refid="client.classpath.lib"/>

            </classpath>

</java>

 

If the @{configDir} directory does not have spaces then the build succeeds.
We have tried specifying @{configDir} in "", '', but it didn't work.

 

Kindly provide some pointers to resolve the issue.

 

 

Thanks,

 

Vivek Payala | Team Lead - Configuration Management (Professional & Managed
Services Group) | Persistent Systems

 <ma...@persistent.co.in> vivek_payala@persistent.co.in  |
Cell: +91 93701 31472 | Tel: +91 (20) 3023 6447

Innovation in software product design, development and delivery-
<http://www.persistentsys.com/> www.persistentsys.com

 


DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.

AW: Build fails when 'java' task's "arg line" contains a directory path with spaces

Posted by Ja...@rzf.fin-nrw.de.
>> Just correcting my example; obviously you only want to quote the
individual
>> arguments: <arg line="'@{type}' '@{configDir}'"/>
>
>That could still confuse the line breaking code.
>
>I would suggest
>
>1. breaking everything up
>
><arg value="@{type}"/>
><arg location="@{configDir}"/>
>
>
>2. run ant -verbose to see what is being passed in
>
>The @{} signs show that macros are at play; if there is one place bad 
>things happen it is there, as property expansion can take place twice, 
>and other quirks may show up.
>
>-steve


I suggest also that you try the prompted command.
Ant will prompt the generated command in verbose|debug mode...


Jan

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


Re: Build fails when 'java' task's "arg line" contains a directory path with spaces

Posted by Steve Loughran <st...@apache.org>.
Chad McHenry wrote:
> Just correcting my example; obviously you only want to quote the individual
> arguments: <arg line="'@{type}' '@{configDir}'"/>

That could still confuse the line breaking code.

I would suggest

1. breaking everything up

<arg value="@{type}"/>
<arg location="@{configDir}"/>


2. run ant -verbose to see what is being passed in

The @{} signs show that macros are at play; if there is one place bad 
things happen it is there, as property expansion can take place twice, 
and other quirks may show up.

-steve

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


Re: Build fails when 'java' task's "arg line" contains a directory path with spaces

Posted by Chad McHenry <mc...@gmail.com>.
Just correcting my example; obviously you only want to quote the individual
arguments: <arg line="'@{type}' '@{configDir}'"/>

On Tue, Sep 30, 2008 at 9:00 AM, Chad McHenry <mc...@gmail.com> wrote:

> I'm surprised Andy's suggestion did not work, as it is the equivalent of
> placing quotes around the individual arguments. Two things you could look
> into: First, are you sure the java app you are running (com.abc.a in the
> example) can handle spaces in filenames, and the bug is not in the program
> itself? Second, have you tried inserting your own quotes into the argument
> value, e.g. <arg line="'@{type} @{configDir}'"/> (note the single quotes
> inside the doubles)? For instance, if com.abc.a uses the exec command
> improperly, these might help. Looking forward to hearing your final
> solution.
>
>
> On Tue, Sep 30, 2008 at 6:13 AM, Vivek Payala <
> vivek_payala@persistent.co.in> wrote:
>
>> Thanks Andy for your response. Unfortunately, modifying the arguments as
>> per
>> your suggestion didn't help.
>>
>>
>>
>> As I described earlier, even though <arg line="@{type} @{configDir}"/> is
>> mentioned the same way (without multiple <arg line statements), and if
>> @{configDir} contains the directory path without spaces, the build is
>> successful. Only when @{configDir} contains spaces the build fails.
>>
>>
>>
>>
>>
>> Thanks,
>>
>>
>>
>> Vivek Payala | Team Lead - Configuration Management (Professional &
>> Managed
>> Services Group) | Persistent Systems
>>
>> vivek_payala@persistent.co.in  | Cell: +91 93701 31472 | Tel: +91 (20)
>> 3023
>> 6447
>>
>> Innovation in software product design, development and delivery-
>> www.persistentsys.com
>>
>>
>>
>>
>>
>> -----Original Message-----
>> From: Andy Stevens [mailto:insomniacpenguin@googlemail.com]
>> Sent: Tuesday, September 30, 2008 4:24 AM
>> To: Ant Users List
>> Subject: Re: Build fails when 'java' task's "arg line" contains a
>> directory
>> path with spaces
>>
>>
>>
>> 2008/9/29 Vivek Payala <vi...@persistent.co.in>:
>>
>> > Our build fails while executing the following task. It fails only when
>> the
>>
>> > application is installed in a directory having space.
>>
>> >
>>
>> > <java classname="com.abc.a" failonerror="true" fork="yes"
>> maxmemory="512m"
>>
>> > errorproperty="runerror">
>>
>> >            <jvmarg value="-server"/>
>>
>> >            <arg line="@{type} @{configDir}"/>
>>
>> >            <classpath>
>>
>> >             <path refid="client.classpath.lib"/>
>>
>> >            </classpath>
>>
>> > </java>
>>
>> >
>>
>> > If the @{configDir} directory does not have spaces then the build
>> succeeds.
>>
>> > We have tried specifying @{configDir} in "", '', but it didn't work.
>>
>>
>>
>> Instead of
>>
>> <arg line="@{type} @{configDir}"/>
>>
>> how about using
>>
>> <arg value="@{type}"/>
>>
>> <arg value="@{configDir}"/>
>>
>> instead?  As the docs say, value "can contain space characters" while
>>
>> line is "space-delimited" and "It is highly recommended to avoid the
>>
>> line version when possible."  I don't see anything that says you can
>>
>> only have a single nested arg element.
>>
>>
>>
>>
>>
>> Andy.
>>
>> --
>>
>> http://pseudoq.sourceforge.net/  Open source java Sudoku application
>>
>>
>>
>> ---------------------------------------------------------------------
>>
>> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>>
>> For additional commands, e-mail: user-help@ant.apache.org
>>
>>
>> DISCLAIMER
>> ==========
>> This e-mail may contain privileged and confidential information which is
>> the property of Persistent Systems Ltd. It is intended only for the use of
>> the individual or entity to which it is addressed. If you are not the
>> intended recipient, you are not authorized to read, retain, copy, print,
>> distribute or use this message. If you have received this communication in
>> error, please notify the sender and delete all copies of this message.
>> Persistent Systems Ltd. does not accept any liability for virus infected
>> mails.
>>
>
>

Re: Build fails when 'java' task's "arg line" contains a directory path with spaces

Posted by Chad McHenry <mc...@gmail.com>.
I'm surprised Andy's suggestion did not work, as it is the equivalent of
placing quotes around the individual arguments. Two things you could look
into: First, are you sure the java app you are running (com.abc.a in the
example) can handle spaces in filenames, and the bug is not in the program
itself? Second, have you tried inserting your own quotes into the argument
value, e.g. <arg line="'@{type} @{configDir}'"/> (note the single quotes
inside the doubles)? For instance, if com.abc.a uses the exec command
improperly, these might help. Looking forward to hearing your final
solution.

On Tue, Sep 30, 2008 at 6:13 AM, Vivek Payala <vivek_payala@persistent.co.in
> wrote:

> Thanks Andy for your response. Unfortunately, modifying the arguments as
> per
> your suggestion didn't help.
>
>
>
> As I described earlier, even though <arg line="@{type} @{configDir}"/> is
> mentioned the same way (without multiple <arg line statements), and if
> @{configDir} contains the directory path without spaces, the build is
> successful. Only when @{configDir} contains spaces the build fails.
>
>
>
>
>
> Thanks,
>
>
>
> Vivek Payala | Team Lead - Configuration Management (Professional & Managed
> Services Group) | Persistent Systems
>
> vivek_payala@persistent.co.in  | Cell: +91 93701 31472 | Tel: +91 (20)
> 3023
> 6447
>
> Innovation in software product design, development and delivery-
> www.persistentsys.com
>
>
>
>
>
> -----Original Message-----
> From: Andy Stevens [mailto:insomniacpenguin@googlemail.com]
> Sent: Tuesday, September 30, 2008 4:24 AM
> To: Ant Users List
> Subject: Re: Build fails when 'java' task's "arg line" contains a directory
> path with spaces
>
>
>
> 2008/9/29 Vivek Payala <vi...@persistent.co.in>:
>
> > Our build fails while executing the following task. It fails only when
> the
>
> > application is installed in a directory having space.
>
> >
>
> > <java classname="com.abc.a" failonerror="true" fork="yes"
> maxmemory="512m"
>
> > errorproperty="runerror">
>
> >            <jvmarg value="-server"/>
>
> >            <arg line="@{type} @{configDir}"/>
>
> >            <classpath>
>
> >             <path refid="client.classpath.lib"/>
>
> >            </classpath>
>
> > </java>
>
> >
>
> > If the @{configDir} directory does not have spaces then the build
> succeeds.
>
> > We have tried specifying @{configDir} in "", '', but it didn't work.
>
>
>
> Instead of
>
> <arg line="@{type} @{configDir}"/>
>
> how about using
>
> <arg value="@{type}"/>
>
> <arg value="@{configDir}"/>
>
> instead?  As the docs say, value "can contain space characters" while
>
> line is "space-delimited" and "It is highly recommended to avoid the
>
> line version when possible."  I don't see anything that says you can
>
> only have a single nested arg element.
>
>
>
>
>
> Andy.
>
> --
>
> http://pseudoq.sourceforge.net/  Open source java Sudoku application
>
>
>
> ---------------------------------------------------------------------
>
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
>
> For additional commands, e-mail: user-help@ant.apache.org
>
>
> DISCLAIMER
> ==========
> This e-mail may contain privileged and confidential information which is
> the property of Persistent Systems Ltd. It is intended only for the use of
> the individual or entity to which it is addressed. If you are not the
> intended recipient, you are not authorized to read, retain, copy, print,
> distribute or use this message. If you have received this communication in
> error, please notify the sender and delete all copies of this message.
> Persistent Systems Ltd. does not accept any liability for virus infected
> mails.
>

RE: Build fails when 'java' task's "arg line" contains a directory path with spaces

Posted by Vivek Payala <vi...@persistent.co.in>.
Thanks Andy for your response. Unfortunately, modifying the arguments as per
your suggestion didn't help.

 

As I described earlier, even though <arg line="@{type} @{configDir}"/> is
mentioned the same way (without multiple <arg line statements), and if
@{configDir} contains the directory path without spaces, the build is
successful. Only when @{configDir} contains spaces the build fails.

 

 

Thanks,

 

Vivek Payala | Team Lead - Configuration Management (Professional & Managed
Services Group) | Persistent Systems

vivek_payala@persistent.co.in  | Cell: +91 93701 31472 | Tel: +91 (20) 3023
6447

Innovation in software product design, development and delivery-
www.persistentsys.com

 

 

-----Original Message-----
From: Andy Stevens [mailto:insomniacpenguin@googlemail.com] 
Sent: Tuesday, September 30, 2008 4:24 AM
To: Ant Users List
Subject: Re: Build fails when 'java' task's "arg line" contains a directory
path with spaces

 

2008/9/29 Vivek Payala <vi...@persistent.co.in>:

> Our build fails while executing the following task. It fails only when the

> application is installed in a directory having space.

> 

> <java classname="com.abc.a" failonerror="true" fork="yes" maxmemory="512m"

> errorproperty="runerror">

>            <jvmarg value="-server"/>

>            <arg line="@{type} @{configDir}"/>

>            <classpath>

>             <path refid="client.classpath.lib"/>

>            </classpath>

> </java>

> 

> If the @{configDir} directory does not have spaces then the build
succeeds.

> We have tried specifying @{configDir} in "", '', but it didn't work.

 

Instead of

<arg line="@{type} @{configDir}"/>

how about using

<arg value="@{type}"/>

<arg value="@{configDir}"/>

instead?  As the docs say, value "can contain space characters" while

line is "space-delimited" and "It is highly recommended to avoid the

line version when possible."  I don't see anything that says you can

only have a single nested arg element.

 

 

Andy.

-- 

http://pseudoq.sourceforge.net/  Open source java Sudoku application

 

---------------------------------------------------------------------

To unsubscribe, e-mail: user-unsubscribe@ant.apache.org

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


DISCLAIMER
==========
This e-mail may contain privileged and confidential information which is the property of Persistent Systems Ltd. It is intended only for the use of the individual or entity to which it is addressed. If you are not the intended recipient, you are not authorized to read, retain, copy, print, distribute or use this message. If you have received this communication in error, please notify the sender and delete all copies of this message. Persistent Systems Ltd. does not accept any liability for virus infected mails.

Re: Build fails when 'java' task's "arg line" contains a directory path with spaces

Posted by Andy Stevens <in...@googlemail.com>.
2008/9/29 Vivek Payala <vi...@persistent.co.in>:
> Our build fails while executing the following task. It fails only when the
> application is installed in a directory having space.
>
> <java classname="com.abc.a" failonerror="true" fork="yes" maxmemory="512m"
> errorproperty="runerror">
>            <jvmarg value="-server"/>
>            <arg line="@{type} @{configDir}"/>
>            <classpath>
>             <path refid="client.classpath.lib"/>
>            </classpath>
> </java>
>
> If the @{configDir} directory does not have spaces then the build succeeds.
> We have tried specifying @{configDir} in "", '', but it didn't work.

Instead of
<arg line="@{type} @{configDir}"/>
how about using
<arg value="@{type}"/>
<arg value="@{configDir}"/>
instead?  As the docs say, value "can contain space characters" while
line is "space-delimited" and "It is highly recommended to avoid the
line version when possible."  I don't see anything that says you can
only have a single nested arg element.


Andy.
-- 
http://pseudoq.sourceforge.net/  Open source java Sudoku application

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