2012-03-20 3 views
2

私のような何かを変換したい:AntのプロパティをAntのリソースに変換するには?

<property name='aoeu' value='a,o,e,u'/> 

に:aoeuの

<path id='ueoa'> 
    <pathelement location="a/file"/> 
    <pathelement location="o/file"/> 
    <pathelement location="e/file"/> 
    <pathelement location="u/file"/> 
</path> 

値はカンマで区切られた任意の数の要素を含めることができます。

私はgroovy Antタスクを使用できますが、ant-contribからは何も使用できません。私が本当にしたいことは何かであるとき

ueoa=ueoa-a=a/file, ueoa-o=o/file, ueoa-e=e/file, ueoa-u=u/file 

ueoa=/path/to/a/file:/path/to/o/file:/path/to/e/file:/path/to/u/file 

はどのようにすることができますようueoaを作成

<groovy> 
    properties['aoeu'].tokenize(',').each() { 
     properties["ueoa-${it}"] = "${it}/file" 
    } 
</groovy> 

<propertyset id='ueoa'> 
    <propertyref prefix='ueoa-'/> 
</propertyset> 

はこれまでのところ、私は以下の持っていますこの変換を有効にしますか?あるいは、groovy Antタスクでどのようにリソースを作成するのですか?

答えて

3

次働い:

<groovy> 
    ant.path(id:'ueoa') { 
     properties['aoeu'].tokenize(',').each() { 
      pathelement(location:"${it}/file") 
     } 
    } 
</groovy> 
関連する問題