Hello Jan,

I think Basin is stating that if you invoke ant from the command line and pass it an explicit target to invoke (instead of whatever default target is configured for that project) and if you have a -D property which doesn't specify a value, then the explicit target name that you specified is ignored and instead Ant just runs the default target configured for that project.

I haven't had a chance to try it out myself, but having seen similar issues reported (outside of Ant) when -D with an empty property value is used in Windows, I wouldn't be surprised if this is Windows specific.

-Jaikiran

On 06/07/21 5:50 pm, apa...@materne.de wrote:
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


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

Reply via email to