【问题标题】:how to access the .properties file in ant if it is in different location如果它位于不同的位置,如何访问 ant 中的 .properties 文件
【发布时间】:2013-08-13 16:38:57
【问题描述】:
<property file="Build.properties"/>
如果build.properties 文件位于项目的根目录中,则此选项有效。现在,如果 Build.properties 文件位于 src 文件夹中且 build.xml 位于根目录(主项目根目录)中,那么访问该文件的语法是什么build.properties 文件。
【问题讨论】:
标签:
java
ant
properties-file
【解决方案1】:
这可以通过两种方式来完成
在类路径中给出位置。
<property file="src/build.properties" />
他们都为我工作。
【解决方案2】:
您可以在启动 ant 脚本时定义属性。
和
使用 ${proj_home}*.properties 访问您的属性文件。
希望能帮助到你。
【解决方案3】:
其他答案有效。请注意,您可以将属性文件作为 ant 命令行传递
ant -propertyfile src/build.properties