groovy

Command line option -D does not work in Windows XP but does in MacOSX

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: 1.5.1
  • Fix Version/s: 1.5.2, 1.6-rc-2
  • Component/s: None
  • Labels:
    None
  • Environment:
    Windows XP
  • Number of attachments :
    0

Description

In WindowsXP...

Z:\dev>gant -D barney=123
Target 123 does not exist.
Z:\dev>gant -D barney=abc
Target abc does not exist.
Z:\dev>gant -D barney="abc"
Target abc does not exist.

In MacOSX

$ gant -D barney=123
123
[echo] 123

Example Gant file:

target ( main : 'A target' ) {
println barney
echo ( message : barney )
}

setDefaultTarget ( main )

Issue Links

Activity

Hide
Russel Winder added a comment -

Is this naked Windows or using Cygwin or MSYS? This is important since it is a question of whether it is the DOS batch file or the Posix shell script.

Someone had a very similar problem some months ago with the DOS batch script. After a lot of experimentation, in the end, they discovered that the only thing that worked was:

gant "-D barney=123"

This is a DOS batch file issue not a Gant source code issue. An alternative to the above is to use the native launcher instead of the DOS batch file.

Show
Russel Winder added a comment - Is this naked Windows or using Cygwin or MSYS? This is important since it is a question of whether it is the DOS batch file or the Posix shell script. Someone had a very similar problem some months ago with the DOS batch script. After a lot of experimentation, in the end, they discovered that the only thing that worked was: gant "-D barney=123" This is a DOS batch file issue not a Gant source code issue. An alternative to the above is to use the native launcher instead of the DOS batch file.
Hide
Gifford Louie added a comment -

This was naked Windows.

The syntax
gant "-D barney=123"
does work.

Another caution is that a trailing backslash such as
gant "-D path=C:\Temp\"
causes unexpected problems.

Show
Gifford Louie added a comment - This was naked Windows. The syntax gant "-D barney=123" does work. Another caution is that a trailing backslash such as gant "-D path=C:\Temp\" causes unexpected problems.
Hide
Russel Winder added a comment -

I have moved this from being a bug in Gant to being a bug in Groovy. The problem resides in the Windows/DOS batch scripts. The Gant scripts is essentially identical to the Groovy and Groovyc scripts, so the problem is in the relationship between the initiating script, startGroovy.bat and actually executing the Java command.

I am assuming the only reason it comes up with Gant now is that Groovy and Groovyc don't take -D options.

Show
Russel Winder added a comment - I have moved this from being a bug in Gant to being a bug in Groovy. The problem resides in the Windows/DOS batch scripts. The Gant scripts is essentially identical to the Groovy and Groovyc scripts, so the problem is in the relationship between the initiating script, startGroovy.bat and actually executing the Java command. I am assuming the only reason it comes up with Gant now is that Groovy and Groovyc don't take -D options.
Hide
Russel Winder added a comment -

It had been marked fixed in Gant since there was a work around, but it wasn't fixed.

Show
Russel Winder added a comment - It had been marked fixed in Gant since there was a work around, but it wasn't fixed.
Hide
Paul King added a comment - - edited

I have applied a patch which improves this area. While not perfect should be good enough to close off this issue. The following testcases (among others) were used:

groovy.bat -D test=3.5 -e "assert 4.0 * System.getProperty('test').toDouble() == 14.0"
groovy.bat -Dprop=abc -e "assert System.getProperty('prop') * 2 == 'abcabc'"
Show
Paul King added a comment - - edited I have applied a patch which improves this area. While not perfect should be good enough to close off this issue. The following testcases (among others) were used:
groovy.bat -D test=3.5 -e "assert 4.0 * System.getProperty('test').toDouble() == 14.0"
groovy.bat -Dprop=abc -e "assert System.getProperty('prop') * 2 == 'abcabc'"
Hide
Paul King added a comment -

I believe this is fixed and now merged onto 1.5.2.

Show
Paul King added a comment - I believe this is fixed and now merged onto 1.5.2.
Hide
Paul King added a comment -

close off release 1.5.4

Show
Paul King added a comment - close off release 1.5.4

People

Vote (0)
Watch (1)

Dates

  • Created:
    Updated:
    Resolved: