简体   繁体   中英

Read <property> value from file within build.xml

Can I read the the property value from an external file instead of specifing the value within the <property> tag.

So instead of -

 <property name="device" value="test" />

Use something like

 <property name="device" value="c:\\fileToRead" />

where file to read contains test,test2,test3

Thanks

<property>任务提供了一种加载Java属性文件的方法,如果您的意思是这样的话:

<property file="c:\\fileToRead"/>

Maybe. While you can't use the content of the file, you can use a file that looks like so:

device=C:\\fileToRead

and then read that with

<property file="foo.properties"/>

( see the docs ).

in build.xml

<property file="general.properties" />

general.properties file

svnant.version=1.0.0
lib.dir=${ant.home}/lib

So for you will be:

<property file="c:\\fileToRead" />

fileToRread is

 device=test

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