You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Wes Moulder <wm...@axyssolutions.com> on 2000/09/20 20:23:23 UTC

random null directory?

I've got a batch file I use to set some properties that get passed into Ant.
These properties are set in Ant as well, but I use the batch file to keep
all the environmental information in one place between multiple people
working on the same project.  The project is not all ant, so I have to keep
the environment set in a batch file.  U would rather not have to set it
multiple places.
That being said, if my batch file passes in a variable that happens to be
"", it doesn't fail, instead it treats it as the string "null".  One of the
directories I pass in is the "library" directory, for where I want all my
jar files to go once I create them.  If this isn't set, though, it becomes
"null", even though it's set in my xml file. Since it's not got a path, it
becomes "${CWD}\null", making everything into there.  This is annoying but
would not be disasterous if I were using all ant...  As it is, various tests
look for the jars in the appropriate library directory, and fail because
they can't find them.  In the interests of "Fail early, fail meaningfully.",
I want to know if it's possible to make it fail if a variable is not set
(set to "null")?
Thanks in advance,
Wes Moulder


RE: random null directory?

Posted by Wes Moulder <wm...@axyssolutions.com>.
It's more like the latter.  Diane provided a decent work around.  I was just
using:
java -Dproperty=$property org.apache.tools.ant.Main
and if $property was not set, then it would pass in a blank, causing
property to become "", which translates to a "null" which is a relative path
if you use it as a name of a directory, which was the root of the whole
trouble. (Did I get enough whiches in there?  Ya might think it's
approaching Halloween! 8) )
so it works, it's just my shell scripts look rather nasty.
Thanks though,
Wes

> -----Original Message-----
> From: Stefan Bodewig [mailto:bodewig@bost.de]
> Sent: Thursday, September 21, 2000 2:49 AM
> To: ant-user@jakarta.apache.org
> Subject: Re: random null directory?
>
>
> >>>>> "WM" == Wes Moulder <wm...@axyssolutions.com> writes:
>
>  WM> That being said, if my batch file passes in a variable that
>  WM> happens to be "", it doesn't fail, instead it treats it as the
>  WM> string "null".
>
> It should treat it as an empty string, not "null". Could you please
> show us how you are invoking ant exactly, is this something like
>
> ant.bat -Dproperty=
>
> or more like
>
> java org.apache.tools.ant.Main -Dproperty=
>
> or
>
> java -Dproperty= org.apache.tools.ant.Main
>
> Stefan
>


Re: random null directory?

Posted by Stefan Bodewig <bo...@bost.de>.
>>>>> "WM" == Wes Moulder <wm...@axyssolutions.com> writes:

 WM> That being said, if my batch file passes in a variable that
 WM> happens to be "", it doesn't fail, instead it treats it as the
 WM> string "null".

It should treat it as an empty string, not "null". Could you please
show us how you are invoking ant exactly, is this something like

ant.bat -Dproperty=

or more like

java org.apache.tools.ant.Main -Dproperty=

or

java -Dproperty= org.apache.tools.ant.Main 

Stefan