Kevin Dickover wrote:
you're not the only one to think this. The problem is that conceptually the <property> tag defines the default value but in terms of nant initialization the commandline value is set first before the <property> tag is processed so Nant sees the property already exists. This is, as you pointed out quite confusing which is why I proposed the <param> solution. Unfortunately that won't be going in before the 0.85 release as it will need a bit of work.Cool thanks. However that might want to be clarified in the docs. I assumed from "Specifies whether the value of a property should be overwritten if the property already exists (unless the property is read-only). The default is true. " that overwrite="true" meant that it could be over written. Obviously that was an incorrect assumption.
In some ways - the previous behaviour - where nant just silently ignored the <property> tag if the value was already set was better with regard to commandline args - the problem was that you'd get no feedback when trying to update a readonly property.
Ian
Kevin
-----Original Message-----
From: Gert Driesen [mailto:[EMAIL PROTECTED] Sent: Wednesday, September 01, 2004 2:03 PM
To: Kevin Dickover; [EMAIL PROTECTED]
Subject: Re: [Nant-users] Params vs properties redux was: Nant .85 not
working with Draco.Net-Again
Kevin,
Just set overwrite to "false" :
<project name="Proptest" default="testProperty"> <property name="ENV" value="DEV" overwrite="false" readonly="false" /> <target name="testProperty"> <echo message="${ENV}" /> </target> </project>
Hope this helps,
Gert
----- Original Message ----- From: "Kevin Dickover" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, September 01, 2004 7:54 PM
Subject: Re: [Nant-users] Params vs properties redux was: Nant .85 not working with Draco.Net-Again
____________________________________________________________________________Assume a sample build file
<project name="Proptest" default="testProperty"> <property name="ENV" value="DEV" overwrite="true" readonly="false" /> <target name="testProperty"> <echo message="${ENV}" /> </target> </project>
When this is run the output is
C:\Temp\nantest>C:\nant\bin\NAnt.exe NAnt 0.85 (Build 0.85.1684.0; net-1.0.win32; nightly; 8/11/2004) Copyright (C) 2001-2004 Gerry Shaw http://nant.sourceforge.net
Buildfile: file:///C:/Temp/nantest/test.build Target(s) specified: testProperty
testProperty:
[echo] DEV
BUILD SUCCEEDED
Total time: 0.1 seconds.
However when I try to set ENV on the command line I lose - output follows
C:\Temp\nantest>C:\nant\bin\NAnt.exe -D:ENV=JOE NAnt 0.85 (Build 0.85.1684.0; net-1.0.win32; nightly; 8/11/2004) Copyright (C) 2001-2004 Gerry Shaw http://nant.sourceforge.net
Buildfile: file:///C:/Temp/nantest/test.build Target(s) specified: testProperty
BUILD FAILED
C:\Temp\nantest\test.build(2,3): Read-only property "ENV" cannot be overwritten.
Total time: 0 seconds.
Do I really need to go through the absurd little dance of setting up two
properties, one to accept command line input and one to set a default value
if the command line property has not been set? Or is my build bad? As you
can see I am using a fairly recent nightly build...
Kevin Dickover
____________________
This electronic mail (including any attachments) may contain information that is privileged, confidential, and/or otherwise protected from disclosure to anyone other than its intended recipient(s). Any dissemination or use of this electronic email or its contents (including any attachments) by persons other than the intended recipient(s) is strictly prohibited. If you have received this message in error, please notify us immediately by reply email so that we may correct our internal records. Please then delete the original message (including any attachments) in its entirety. Thank you.
________________________________________________________________________________________________
This electronic mail (including any attachments) may contain information that is privileged, confidential, and/or otherwise protected from disclosure to anyone other than its intended recipient(s). Any dissemination or use of this electronic email or its contents (including any attachments) by persons other than the intended recipient(s) is strictly prohibited. If you have received this message in error, please notify us immediately by reply email so that we may correct our internal records. Please then delete the original message (including any attachments) in its entirety. Thank you.
--
Ian MacLean, Developer, ActiveState, a division of Sophos
http://www.ActiveState.com
------------------------------------------------------- This SF.Net email is sponsored by BEA Weblogic Workshop FREE Java Enterprise J2EE developer tools! Get your free copy of BEA WebLogic Workshop 8.1 today. http://ads.osdn.com/?ad_id=5047&alloc_id=10808&op=click _______________________________________________ Nant-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/nant-users