History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: GROOVY-2515
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Minor Minor
Assignee: Paul King
Reporter: Gifford Louie
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
groovy

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

Created: 11/Jan/08 12:44 PM   Updated: 08/Feb/08 01:26 AM
Component/s: None
Affects Version/s: 1.5.1
Fix Version/s: 1.6, 1.5.2

Time Tracking:
Not Specified

Environment: Windows XP
Issue Links:
Related
 


 Description  « Hide
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 )



 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Russel Winder - 11/Jan/08 01:05 PM
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.


Gifford Louie - 18/Jan/08 08:16 AM
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.


Russel Winder - 18/Jan/08 08:53 AM
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.


Russel Winder - 18/Jan/08 08:54 AM
It had been marked fixed in Gant since there was a work around, but it wasn't fixed.

Paul King - 21/Jan/08 12:54 AM - 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'"

Paul King - 25/Jan/08 06:41 AM
I believe this is fixed and now merged onto 1.5.2.

Paul King - 08/Feb/08 01:26 AM
close off release 1.5.4