Reputation: 21
I 'm having a problem with subant and have no ideas any more. Can anyone help? Using Ant to replace some strings for other (i.e Productname and Version for "Foo" and "1.2") I used such thing:
<copy todir="${Foo_Home}\cm_builds\Deployment\Database\Production.win\">
<fileset dir="${Foo_Home}\Deployment\Database\Production.win\"
includes="**/*.sql,**/*.cmd"/>
<filterset>
<filter token="PRODUCTNAME" value="Foo"/>
<filter token="VERSION" value="1.2"/>
</filterset>
</copy>
Can we do the same by means of subant? Because copy
and replacetoken
etc. are not supported by subant. But we need exactly subant...
Something like this:
<subant target="build" genericantfile="build.xml">
<dirset dir="${Foo_Home}\cm_builds\Deployment\Database\Production.win\"
includes ="**/*.sql">
</subant>
Is that the right way to use subant? (Assume we have several targets like this)
http://ant.apache.org/manual/Tasks/subant.html for help =)
I suspect i use subant in a wrong way. Maybe there is no need to try to make subant run the same task as ant does? Maybe i should make subant run ant in a required directory and don't change anything for ant?
Upvotes: 2
Views: 3701
Reputation: 8839
I don't understand what it is that you are trying to do, or what you mean by "copy and replacetoken etc are not supported by subant". The subant
task is used to invoke an Ant build in multiple directories. For example, suppose you have a property ${top}
that points to a directory that contains subdirectories named one
, two
, and three
. Then you could use a subant
task to invoke Ant in each of those subdirectories like this:
<subant genericantfile="${top}/build.xml" target="build">
<!-- include all subdirectories in ${top} -->
<dirset dir="${top}"/>
</subant>
This would be roughly equivalent to the following commands at a command prompt (assuming that the directory top
is located in /work/top
):
$ cd /work/top
$ cd one
$ ant -f ../build.xml build
$ cd ../two
$ ant -f ../build.xml build
$ cd ../three
$ ant -f ../build.xml build
Finally, your usage of dirset
is incorrect. A dirset is a group of directories, not files, so your dirset
above will include all directories that end with .sql
, which I suspect is not what you want.
Upvotes: 5