Specifying both multiple targets and multiple build files with ant or subant in 1.6

Posted by Paul Marshall on Stack Overflow See other posts from Stack Overflow or by Paul Marshall
Published on 2010-04-30T02:34:34Z Indexed on 2010/04/30 2:37 UTC
Read the original article Hit count: 282

Filed under:

I'm trying to unify a build process, running one build to get multiple packages. My first shot at this is just having a central build script call <ant> or <subant> on each project's build.xml file. I'm using Ant 1.6, and I've run into a funny problem: either I use the <ant> task, and I can specify multiple targets but not multiple build files, or I use the <subant> task, and I can specify multiple build files but not multiple targets.

I realize there's a few solutions here already:

  1. Just upgrade to Ant 1.7 already; <antcall> can do multiple targets there.
  2. Edit the separate project build files to have a variety of top-level targets, so I can call each individual file with just one target, and use <antcall>.
  3. Copy-paste a lot of <ant> tasks, with a little help from <macrodef> to help the sanity.

Is there something I've missed, that will allow me to do what I want from this single central build.xml without a) editing individual project files, b) writing lots of repetitive code, or c) upgrading Ant, and that d) doesn't require editing every time I add a new project?

© Stack Overflow or respective owner

Related posts about ant