Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/388.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/ant/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Anttask:“值”和“位置”之间有区别吗?_Java_Ant - Fatal编程技术网

Java Anttask:“值”和“位置”之间有区别吗?

Java Anttask:“值”和“位置”之间有区别吗?,java,ant,Java,Ant,将属性设置为引用文件路径时,使用值参数和位置参数之间是否存在差异 会议上的文件指出: 值设置属性的值 位置将属性设置为给定文件的绝对文件名 一般值的值和文件路径的位置也是一样的吗 在现实生活中的例子中,这两行代码之间有区别吗?如果是,它有什么实际影响 <property name="cobertura.dir" value="C:/Cobertura/cobertura-1.9" /> <property name="cobertura.dir" locatio

将属性设置为引用文件路径时,使用值参数和位置参数之间是否存在差异

会议上的文件指出:

值设置属性的值

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

一般值的值和文件路径的位置也是一样的吗

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

    <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.
因此,您可以选择指定绝对/相对路径


所以,如果您想要执行相对路径,则使用位置。如果您正在执行绝对路径,则可以使用位置或互斥值。您已经参考过的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.
因此,您可以选择指定绝对/相对路径


所以,如果您想要执行相对路径,则使用位置。如果您正在执行绝对路径,则可以使用位置或值互斥,以防它帮助其他人:

作者建议:

对于表示文件或目录的属性,请使用“位置” 属性,而不是“值”

.properties文件等同于使用 因为没有使用“location”属性。不建议将其用于 文件和目录,因为这不会解析相对 参考资料。如果在属性文件中指定了位置,则 应该是绝对的,而不是相对的。此外,你还需要逃跑 反斜杠


如果对其他人有帮助:

作者建议:

对于表示文件或目录的属性,请使用“位置” 属性,而不是“值”

.properties文件等同于使用 因为没有使用“location”属性。不建议将其用于 文件和目录,因为这不会解析相对 参考资料。如果在属性文件中指定了位置,则 应该是绝对的,而不是相对的。此外,你还需要逃跑 反斜杠


谢谢你的快速回复。我认为这还不能回答我的问题,因为你在手册中引用的只是位置的价值。它没有解释位置和值参数之间的差异。编辑我的答案以获得更好的图片。请看一下。谢谢您的快速回复。我认为这还不能回答我的问题,因为你在手册中引用的只是位置的价值。它没有解释位置和值参数之间的差异。编辑我的答案以获得更好的图片。请看一看。