IntelliJ - Ant integration

The fact that IntelliJ is off-the-shelf ready to work with Ant is a great, great feature. It's also simple to configure and use.

Assuming that you already know how to use Ant, and you have a build.xml file ready to go, just follow these steps to (a) configure your build script to run from within IntelliJ, and (b) run Ant:

  • Assuming you're in an IntelliJ project, select 6: Ant Build from the slide-in menu bar ("Tool Window Bar") on the right side of your screen.
  • Click the large plus sign icon to add your build.xml file to IntelliJ's list of known build scripts for this project.
  • Navigate the filesystem until you find your build script (i.e., your build.xml file for this project). Select that file.
  • To run a desired Ant task, double-click the task name that you want to run. My main task is usually named deploy, so I double-click that.
  • Ant should run properly for you, and deploy your application.

It's really that simple.

The worst problem I've run into so far is that when I work on projects on multiple computer systems, my build scripts rely on an environment parameter named ANT_HOST_NAME existing. So, when my build script failed the first time, I said "Oh, dummy Al, you need to set your ANT_HOST_NAME environment parameter. Once I did this and restarted IntelliJ, the Ant build process worked like a champ.

Kudos, dear IntelliJ developers. Great product feature!