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 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

Reply via email to