Configuring Eclipse To Use Command Line Ant

October 14, 2008 by Jim · 3 Comments 

Today I finally got around to reconfiguring my local Ant install.  I updated to the latest version and also configured Eclipse to use the same Ant files.

I’ve known you could do this for awhile but today I was talking to Qasim in our daily scrum and finally decided to take a bit of time to do this and document it on our internal WIKI so the whole team can get setup the same way.

Lets get started!

Next I have some additional Ant tasks (antcontrib, mail, etc)  that require some additional jar files.  You can copy those to your newly installed Ant lib directory:  D:\ant\lib

Note: At some point I will probably move these additional tasks off to a network share so we can all reference the same tasks – but for now I’m going to KISS and just dump them in the local directory.

Now we need to configure Eclipse to point to our new installation of Ant instead of it’s own copy.

  • Open Eclipse
  • Click Window > Preferences
  • Expand Ant
  • Click Runtime
  • Note Ant paths are local to Eclipse
Eclipse Ant

Eclipse Ant Preferences

  • Click ‘Ant Home’
  • Navigate to your newly installed Ant directory
Local Ant directory

Local Ant directory

  • Select the Ant directory
  • Click OK
  • Click OK (exit Preferences)
  • Verify your Ant tasks work!

Now you should be able to run the same tasks from the command line or from within Eclipse and use the same task extensions.

Possibly Related:

Comments

3 Responses to “Configuring Eclipse To Use Command Line Ant”
  1. Nice. I wrote about how to do exactly the opposite a while back just to reduce the number of Ant installs I had laying around. :-)

  2. Glad to hear that you were able to set up a central ANT installation. By the way thanks for explaining this publicly – I am sure a lot of people will benefit from this write up.

Trackbacks

Check out what others are saying about this post...
  1. [...] this comes up, try configuring Eclipse to use the ’system’ version of ANT by following these instructions. July 21st, [...]



Tell us what you're thinking...