>I am working on a project that consists of multiple modules. >Each module has an identical folder structure within it. >Initially I started by having multiple build scripts (one for >each module) but this was a little problematic because there >are some dependancies between the modules. It seemed ugly to >have one module's build script call another so I went looking >for another solution. I found a best practice document that >told me to lean towards using a single build script where >possible. This made sense to me because if I had one master >build script with targets to build each module then I could >manage the dependancies with the ant target 'depends'. >Dependancies would be intra-script rather than inter-script. I >decided to adopt this approach.
I would try a build script in each module, <import>ing a standard buildfile. And a master buildfile calling the different module-buildfiles. So you´ll get a scenario like described in the last example of <subant> http://ant.apache.org/manual/CoreTasks/subant.html with the difference that the master buildfile uses <antcall> instead of <subant> ... >As I began to build the script I created properties like this.... > ><property name="module1.src.dir" location="modules/module1/src/java"/> ><property name="module2.src.dir" location="modules/module2/src/java"/> Would be defined as <property name="src.dir" location="src/java"/> inside the common.xml. Because the common file is <import>ed the location is resolved to the importing buildfile location. >But when you have properties for docs directorys, lib >directorys, classes directorys etc etc and mutliply this by >the number of modules it becomes difficult to management and >feels like there should be a better solution. no more duplicates in that approach ... >I decided that >it would be better to have something like this.... > ><property name="module1.dir" location="modules/module1"/> ><property name="module2.dir" location="modules/module2"/> . >. >. ><property name="src.dir" location="src/java"/> ><property name="docs.dir" location="docs"/> ><property name="api.dir" location="${docs.dir}/api"/> > >As the structures in each module are identical I assumed I >would be able to refer to the module 2 src dir as >"${module2.dir}/${src.dir}", but this doesnt work because both >module2.dir and src.dir are resolved to absolute paths which >messes up the combining of the paths. Dont use "location" - use "value" instead. See http://ant.apache.org/manual/CoreTasks/property.html >My initial solution was to use value rather than location. I >can get this to work but then ant will no longer convert the >path to one which can run on the current platform (by >converting / to \ on windows). Why it should? If you really need a windows-specific path for calling an external application or writing that to a file for an external tool, you could use <pathconvert> for that. >Hopefully this is a little clearer. I would definately >appreciate any suggestions. Assertions that I am a moron and >coming about this in the completely wrong way will be less >appreciated, but still graciously accepted :) Dont expect that. Everyone has started at a low level ;-) Jan --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
