@CrazyCoder is right, using maven would be the best solution, but this conversation might just be too big to grasp.
.iml files are just xml and, although not documented, they are pretty straightforward. You should not create a template and then use the ant property replacement or custom task to create these files for each module.
For reference, you can look at the source maven-idea-plug , it generates .iml files for the maven project, and you can provide a hint on how to do this with ant. Please note that @CrazyCoder points out comments that should only be a link ... do not use this to support maven in Idea.
source share