Ant如何将从文件中读取的值读入属性值?

pin*_*are 12 ant build-process properties build

该文件看起来像:

a1,b1
a2,b2
...
Run Code Online (Sandbox Code Playgroud)

我知道价值"a2".如何将值"b2"转换为属性值.

我知道如何通过以下方式选择包含"a2"的行:

<linecontains>
  <contains value="a2"/>
</linecontains>
Run Code Online (Sandbox Code Playgroud)

我不知道如何将属性值设置为"b2".我随时为您提供更多其他信息.

Mne*_*nth 21

以下是我的诀窍:

<loadfile srcfile="data" property="result">
     <filterchain>
           <linecontains>
                <contains value="a2"/>
           </linecontains>
           <tokenfilter>
                <replacestring from="a2," to=""/>
           </tokenfilter>
    </filterchain>
</loadfile>
<echo message="${result}"/>
Run Code Online (Sandbox Code Playgroud)

正如您所指出的那样,首先选择'a2'.然后令牌过滤器替换a2和冒号.希望有所帮助.