开发者

Refactor Ant scripts - multiple directories

I have a set of databases that are built using scripts that are run using Ant. I have the scripts for each database in a separate directory.

root (build.xml)
 - db1 (build.xml, *.sql)
 - db2 (build.xml, *.sql)
...

The root build.xml has a target

<target name="all">
 <ant dir="db1"/>
 <ant dir="db2"/>
 ...
</target>

The build.xml in each of the subfolders is essentially the same but for the database name.

Is there a way to r开发者_如何学JAVAefactor this to one single build file that runs the sql scripts in each of the folders against the corresponding databases?


Have a look at the subant task. The examples in the docs show how it can be used to iteratively invoke Ant builds in subdirectories.


Depends very much on what's in your build files. In general, <for> or <foreach> might help you to iterate over the sub-folders and apply a piece of script to each of them.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜