Maybe this?

<project>
  <property name="msg" value="default"/>
  <echo>${msg}</echo>
</project>

C:\temp>ant
Buildfile: C:\temp\build.xml
     [echo] default

BUILD SUCCESSFUL
Total time: 0 seconds

C:\temp>ant -Dmsg=hello
Buildfile: C:\temp\build.xml
     [echo] hello

BUILD SUCCESSFUL
Total time: 0 seconds

C:\temp>ant -Dmsg=""
Buildfile: C:\temp\build.xml
     [echo]

BUILD SUCCESSFUL
Total time: 0 seconds



Jan

-----Ursprüngliche Nachricht-----
Von: Basin Ilya <basini...@gmail.com> 
Gesendet: Montag, 5. Juli 2021 21:36
An: user@ant.apache.org
Betreff: empty properties on command line

Hi list.
Looks like it's well-known, but I can't find in the docs.
Trying to pass a property with an empty value on the command line leads to
ignoring explicit targets:

    C:\16>ant -Daaa= clean
    Buildfile: C:\16\build.xml
    
    default:
         [echo] default
    
    BUILD SUCCESSFUL
    Total time: 0 seconds
    
    C:\16>ant -Daaa=d clean
    Buildfile: C:\16\build.xml
    
    clean:
         [echo] clean
    
    BUILD SUCCESSFUL
    Total time: 0 seconds

Even Eclipse mimics this behavior in
InternalAntRunner.processMinusDProperties()


I expected some info here: https://ant.apache.org/manual/running.html

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org For additional
commands, e-mail: user-h...@ant.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscr...@ant.apache.org
For additional commands, e-mail: user-h...@ant.apache.org

Reply via email to