这可能使用蚂蚁吗?
问题描述:
我有一个需求,我必须在其中创建一个文件,其中将包含源目录名称,目标目录名称将在其中部署的位置以及我需要部署的文件(.jars)列表。这可能使用蚂蚁吗?
我想具有的属性文件,其中i将指定的以下类型
[Src dirctory name] [destination directory]
多行,那么我会从上述文件中读取每一行,并列出[src目录名]中的所有文件,并将喜欢在我的最终属性文件中有以下内容。
appversion @[email protected] (value would com using ant filters)
[some static stuff]
SrcDir [absolute path of Src directory1]
DestDir [destination directory as is]
file 555 [file1.jar]
file 555 [file2.jar]
SrcDir [absolute path of Src directory2]
DestDir [destination directory as is]
file 555 [file1.jar]
file 555 [file2.jar]
.
.
.
SrcDir [absolute path of Src directory n]
DestDir [destination directory as is]
file 555 [file1.jar]
file 555 [file2.jar]
我可以这样做
appversion @[email protected] (value would com using ant filters)
[some static stuff]
@[email protected]
,其中将如上生成的最终名单?还是有更好的方法来做同样的事情。我知道我们可以使用脚本来做,但只是想知道如果我们可以轻松地使用蚂蚁做到这一点?
你能帮我吗?我正在考虑使用蚂蚁过滤器,但无法创建上述类型的结构。你能帮我么?
感谢, 阿尔马斯
答
你可以通过使用一系列的echo task的将文本追加到文件的末尾实现这一目标。
<echo message="${text.to.append}" file="${prop.file}" append="true"/>
或
<echo file="${prop.file}" append="true">
multiple lines of text to append to file here
....
</echo>