Home > Articles > Programming > Java

  • Print
  • + Share This
Like this article? We recommend

Name Your Build File build.xml and Put It in the Root

If you have used Unix's make utility, you know how annoying it is when the make files are not named consistently. The same holds true for Ant's build.xml. I have seen numerous projects in which the build file is renamed or moved from the root of the project, or both.

What this does is turn a three-letter command into an exercise in frustration. Consider which of these two commands would be easier to use frequently:

ant
ant -f etc/ant/build/project.xml

Ant expects a file named build.xml to be located in the current directory, which is generally the root of the project. Keeping the build file with its default name and location will make using Ant more consistent and useable.

Keep the default target in the build file to be the most common usage of the build file. Generally this means that the default target should be either compile or jar. If the default target is some form of deploy or a complete project rebuild, it will not be used often—and the most common usage of the build file will be more complex than necessary.

  • + Share This
  • 🔖 Save To Your Account