[英]Absolute paths in Ant property file
I have a property file containing absolute paths to jars etc. When using these properties they are prefixed with the basedir specified in the build file. 我有一个包含jars等绝对路径的属性文件。使用这些属性时,它们会以在构建文件中指定的basedir开头。 How do I get the absolute path?
我如何获得绝对路径?
build.properties: build.properties:
mylib=/lib/mylib.jar
build.xml: build.xml:
<project name="myproject" basedir=".">
<property file="build.properties"/>
...${mylib}...
</project>
Please take a look at the property task : 请看一下属性任务:
http://ant.apache.org/manual/Tasks/property.html http://ant.apache.org/manual/Tasks/property.html
By using the location attribute eg : 通过使用location属性,例如:
<property name="my.abs.path" location="my.relative.path"/>
<echo message="My abs.path is : ${my.abs.path}"/>
This will expand any relative properties to their full absolute path. 这会将所有相对属性扩展到其完整的绝对路径。 Of course the path is expanded relatively to the project's basedir.
当然,路径相对于项目的基础进行了扩展。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.