English 中文(简体)
Subant targets instead of ant
原标题:
  • 时间:2009-11-17 19:24:12
  •  标签:
  • ant

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_buildsDeploymentDatabaseProduction.win">
    <fileset dir="${Foo_Home}DeploymentDatabaseProduction.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_buildsDeploymentDatabaseProduction.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 =)

Update:

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?

问题回答

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.

Why doesn t the replace task work for you?





相关问题
i want to continously run my java threads

I am running my java application where i have used threads... i am running this application using ant command on the terminal.. But when i close my terminal or press ctrl+c,then java program which was ...

Subant targets instead of ant

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 ...

java ant buildfile for project with dependencies

I am new to ant, but am trying to create an ant script that builds my current proeject with another project as a dependency. I have the ant script building my current project, but am unsure how to add ...

Building Apache Hive - impossible to resolve dependencies

I am trying out the Apache Hive as per http://wiki.apache.org/hadoop/Hive/GettingStarted and am getting this error from Ivy: Downloaded file size doesn t match expected Content Length for http://...

Ivy, ant and start scripts

I have a project that uses ant to build and ivy for dependencies. I would like to generate the start scripts for my project, with the classpath, based on the dependencies configured in Ivy, ...

热门标签