James Adams
James Adams

Reputation: 8727

Ant build won't run in Eclipse

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.

Upvotes: 6

Views: 20919

Answers (3)

Vipin
Vipin

Reputation: 5223

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.

Upvotes: 3

shonky linux user
shonky linux user

Reputation: 6428

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

Upvotes: 4

VonC
VonC

Reputation: 1323115

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.

Upvotes: 1

Related Questions