I have a project with a number of compile-time dependencies on other projects (of the same code-base). So the compile classpath is defined somewhat like the following:
<path id = "compile.classpath">
<fileset dir="${dependency-a.dist.dir}">
<include name ="*.jar"/>
</fileset>
<fileset dir="${dependency-b.dist.dir}">
<include name ="*.jar"/>
</fileset>
<fileset dir="${dependency-c.dist.dir}">
<include name ="*.jar"/>
</fileset>
<fileset dir="${dependency-d.dist.dir}">
<include name ="*.jar"/>
</fileset>
</path>
Also, you can image the corresponding build
targets for the dependencies and so on.
To reduce repetition I need to somehow generate those structures dynamically.
I thought that one Ant-friendly way to capture those dependencies might be to create a deps
directory and add sym-links to all the compile-time dependencies of my project.
So the question is: is there an Ant way to write a macrodef
or a custom Ant task that would scan that directory (or, alternatively, read a configuration file) and expand into/generate the necessary filesets / build targets automatically, in effect changing the XML nodes of the build.xml file at runtime? I am looking for a generic Ant way to do that (if such exist) so I don't have to use the more disruptive way of generating myself the build.xml
file in its entirety from some other configuration. I am not asking how to use subant etc. as I am wondering whether there might exist a more sweeping capability of extending/enriching the Ant build file at runtime that would also apply to other cases not involving building dependencies.