I'm exploring the awesomeness of Ant 1.8.1's import ability. Here's my situation: I have a top-level Ant file (project.xml) that turns around and calls ant on another Ant file (say, neato_project.xml) which actually does the build, or clean or whatever.
I have 12 different project files that this top-level (project.xml) file can call, so I want to put a common classpath entry into the project.xml file that I can pass to 开发者_开发技巧the others to use as their individual classpaths.
How do I do that? I've been trying to play with import task, but I haven't gotten that figured out. I'm open to another approach if there's a better way to approach this problem in Ant.
Import wasn't introduced in 1.8; it was enhanced in 1.8. This is good because it means people like me have a couple years experience with import.
What I do:
- constants.xml - the common strings and classpaths my build uses
- build.xml - the main file imports #1 and #3
- helper-project-1.xml - it has a clearer name, but that's hardly the poing
- helper-project-2.xml, etc
I use this approach because I want build.xml to pass the constants. I only keep them in a separate file for readability.
精彩评论