简体   繁体   中英

how to access the .properties file in ant if it is in different location

<property file="Build.properties"/> 

如果build.properties文件位于project的根目录中,则此方法有效。现在,如果Build.properties文件位于src文件夹中,并且build.xml位于root(主项目根目录)中,则访问该build.properties的语法是什么?文件。

It can be done by giving in two ways

  1. give the loction in classpath.

  2. <property file="src/build.properties" />

Both of them worked for me.

You can define property at starting of your ant script. And use ${proj_home}*.properties to access your property file. Hope it helps.

Other answers are valid. Note that you can pass a property file as ant command line

ant -propertyfile src/build.properties

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM