问题
Ant's config file--build.xml has the property element. And according to the offical-doc,the property has the attributes-value and location. But I don't understand why we need location? Can I set the path as a value in property? Then no need for location.
回答1:
location is used if you want to do relative paths.
notice in this example, they use location. no absolute path needed. http://ant.apache.org/manual/using.html
either location or value (mutually exclusive) can be used if you're doing absolute paths
回答2:
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.
Source : http://ant.apache.org/manual/Tasks/property.html
Example, someone want to store lib dir path in a variable then it can be done as shown below.
<property name="lib.dir" location ="project_home/lib"/>
and you can use the above property as shown below.
<fileset dir="${lib.dir}">
<include name="**/*.jar"/>
</fileset>.
来源:https://stackoverflow.com/questions/14628457/what-s-the-difference-between-ants-property-value-and-property-location