gpt4 book ai didi

java - Ant <属性> 任务 : is there a difference between 'value' and 'location' ?

转载 作者:行者123 更新时间:2023-11-29 03:13:00 25 4
gpt4 key购买 nike

属性设置为引用文件路径时,使用valuelocation参数有区别吗?

文档位于 https://ant.apache.org/manual/Tasks/property.html指出:

value 设置属性的值

location 将属性设置为给定文件的绝对文件名。

value 是否用于一般值,而 location 仅用于文件路径?


在现实生活中,这两行代码有区别吗?如果是这样,它有什么实际影响?

    <property name="cobertura.dir" value="C:/Cobertura/cobertura-1.9" />
<property name="cobertura.dir" location="C:/Cobertura/cobertura-1.9" />

最佳答案

它记录在您已经提到的 ANT 手册中......

location : Sets the property to the absolute filename of the given file. 
If the value of this attribute is an absolute path, it is left unchanged (with / and \ characters converted to the current platforms conventions).
Otherwise it is taken as a path relative to the project's basedir and expanded.

因此您可以选择指定绝对/相对路径。

所以如果你想做相对路径,就用location。如果您正在做绝对路径,则可以使用位置或值(互斥)

关于java - Ant <属性> 任务 : is there a difference between 'value' and 'location' ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28282133/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com