DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20085>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=20085

If a propert is unset, property substitution does nothing

           Summary: If a propert is unset, property substitution does
                    nothing
           Product: Ant
           Version: 1.5.1
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: Core
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


If property foo is not set, no substitution is performed on the string "${foo}".
That is, if I write "myprogram ${foo}" and foo is not set, this string is passed
unmodified so that "myprogram" sees "${foo}" as its argument, not an empty (or
no) argument.

What I'd like to be able to do is write things like 

      <jvmarg value="-DALERT_DIR='${env.ALERT_DIR}'"/>

and if env.ALERT_DIR is not set, for it to expand to an empty string. The fact
that ${env.ALERT_DIR} is unmodified if the variable is unset is bizarre to me,
considering it's not how $-style substitution works anywhere else. Because it's
unlike anything else, I consider it a bug, rather than an RFE.

If someone knows of a workaround, I'd appreciate it, but I can't figure one out.
I set its severity because I couldn't figure out a workaround, but that may be
because I don't know ant well enough.

Here's a build.xml file that shows the problem:

<?xml version="1.0" encoding="UTF-8"?>

<!--
ant build.xml file to show bug in property substitution
-->

  <project name="castellan" default="compile" basedir=".">
  <target name="proptest" description="test ant properties">
    <exec executable="echo">
      <arg line="prop='${prop}'"/>
    </exec>
  </target>

  <target name="proptest2" description="test ant properties">
    <echo message="prop='${prop}'"/>
  </target>

  </project>

Reply via email to