Ant build won't run in Eclipse

18,204

Solution 1

I faced same problem today , reason behind this was ANT_HOME path variable explained in other answers also.

Initially I added ANT_HOME at 2 places given below and it was not working.

window->preferences->ant->runtime->properties Tab

window->preferences->ant->runtime->Classpath Tab

But when I remove Classpath tab ant home entry ( by setting it to default using Restore default option on right bottom of preferences window ) it worked :). So far it is just a surprise for me because I added same ant home path at both the places.

Solution 2

As per pstanton's comment this symptom will occur if your ANT_HOME folder is not correctly defined in Eclipse. Eclipse seems to ignore the ANT_HOME system property.

window->preferences->ant->runtime->Classpath Tab

Solution 3

You can check out the example in this Apache Ant tutorial.

But you can also try to run your same build.xml ant files through a Java Launcher, with org.apache.tools.ant.Main as the Main class.
That would at least prove your scripts are working in an Eclipse environment.

When you look at the Ant FAQ, you also see:

I installed Ant 1.6.x and now get java.lang.InstantiationException: org.apache.tools.ant.Main

The cause of this is that there is an old version of ant somewhere in the class path or configuration.

Maybe your error message is somehow hidden, but it can be worth checking your classpath and see if no other ant library is there.

Share:
18,204
James Adams
Author by

James Adams

Updated on June 24, 2022

Comments

  • James Adams
    James Adams almost 2 years

    I have an Ant build.xml which no longer runs when launched in Eclipse.
    I click on the External Tools Configuration, select the Ant Build I've been running, and click Run.
    Nothing happens -- no console window and the build doesn't appear to launch (the classes are not compile nor is the WAR file created).

    I recently added a plugin (Spring IDE), this is the only thing I can think of that has changed recently as far as my Eclipse configuration.
    I can run the Ant build fine from the command line.

    Can anyone suggest where I might look to track down my error?

    I'm using the Eclipse Helios release, Build id: 20100617-1415 on Windows XP.