You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ant.apache.org by Basin Ilya <ba...@gmail.com> on 2021/07/05 19:35:37 UTC

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-unsubscribe@ant.apache.org
For additional commands, e-mail: user-help@ant.apache.org


Re: AW: empty properties on command line

Posted by Jaikiran Pai <ja...@gmail.com>.
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, apache@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 <ba...@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-unsubscribe@ant.apache.org For additional
> commands, e-mail: user-help@ant.apache.org
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@ant.apache.org
> For additional commands, e-mail: user-help@ant.apache.org
>

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


AW: empty properties on command line

Posted by ap...@materne.de.
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 <ba...@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-unsubscribe@ant.apache.org For additional
commands, e-mail: user-help@ant.apache.org



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