title: How to give a default value for a property that is not set or equals to to an empty string in Ant?
body: <p>I have a <code>build.xml</code> file like this:</p>
  
  <pre><code>&lt;project basedir="." default="test"&gt;
      &lt;target name="test"&gt;
          &lt;condition property="foo" value="${foo}" else="default_value"&gt;
              &lt;and&gt;
                  &lt;not&gt;
                      &lt;equals arg1="${foo}" arg2=""/&gt;
                  &lt;/not&gt;
                  &lt;isset property="foo" /&gt;
              &lt;/and&gt;
          &lt;/condition&gt;
          &lt;echo message="foo: ${foo}"/&gt;
      &lt;/target&gt;
  &lt;/project&gt;
  </code></pre>
  
  <p>How can I change my <code>build.xml</code> file to make the <code>foo</code> property equal to <code>default_value</code> when executing <code>ant -Dfoo=${NONEXISTENT_VALUE} -buildfile build.xml</code> shell script?</p>
  
  <p>The <code>-Dfoo=${NONEXISTENT_VALUE}</code> passes a property to <code>ant</code>.</p>
  
  <p><code>NONEXISTENT_VALUE</code> is an environment variable that's not defined. 
  I mean <code>echo ${NON_EXIST_VALUE}</code> returns an empty line.</p>
  
  <p><code>ant -Dfoo=${NONEXISTENT_VALUE} -buildfile build.xml</code> generates the following result:</p>
  
  <pre><code>test:
       [echo] foo:
  
  BUILD SUCCESSFUL
  Total time: 0 seconds
  </code></pre>
  
  <p>This is not something I want. I expected <code>foo</code> to be <code>default_value</code>.  Because <code>foo</code> is set, and I think it is an empty string.</p>