7

I am unable to right click and run my build.xml file by choosing 'Run as Ant' . Whenever I click it says run configuration and that goes into running Java file options .

RaulGupta
  • 351
  • 1
  • 3
  • 9

8 Answers8

9

This works for me. Go to.. 1. Help -> Install New SoftWare

  1. Work With -> "http://download.eclipse.org/releases/juno"
  2. Drop down list "General Purpose Tools"
  3. select "Eclipse Plug-in Development Environment"

After doing this...eclipse started showing option of Ant Build in Run as

RaulGupta
  • 351
  • 1
  • 3
  • 9
  • Perfect. Fixed my problem in Indigo as well. Not sure how I lost it in first place. May have been my attempt to clean out some files locally. But was pretty sure I never touched a workspace. – Matthew Davis Dec 06 '16 at 01:41
  • Worked perfectly for me with Eclipse Mars (just replaced "juno" with "mars" in the url). – codenaugh Jan 24 '17 at 19:17
5

In Eclipse Neon, the Ant Build moved to Run > External Tools > External Tools Configurations ... it is not located in the default Run anymore.

enter image description here

col.panic
  • 2,944
  • 4
  • 25
  • 31
1

An example of a build xml file and how to run it

enter image description here

enter image description here

I hope this helps!

ricardoramos
  • 891
  • 3
  • 18
  • 35
1

I encountered a configuration where depending on the filename of build.xml file the "Run As" menu did not contain the "Ant Build" and "Ant Build..." commands. The commands "Ant Build" and "Ant Build..." (see the image in ricardoramos's answer) are present if the build file is named build.xml, but absent if the file is named build-something.xml.

I tracked down that the cause of this issue in my configuration was plugin LiClipseText. Uninstalling the plugin resolved the issue. I observed this with LiClipseText version 2.1.2 and with Eclipse versions "2018-09" (4.9), "Photon" (4.8) for Java EE Developers.

The plugin provides its own editor for XML files, and I guess that interferes with the way how Eclipse detects that an XML file is an Ant build file.

It may be that this will be fixed in a future version of LiClipseText.

For a recipe on how to uninstall the plugin - see question 6174725. For a cleanup afterwards - see question 221476.

Konstantin Kolinko
  • 3,854
  • 1
  • 13
  • 21
0

Another possibility is your build.xml file is not parseable by ant

For example, if you open the Ant Perspective (Open Perspective | Other | ant) and then choose the Add Buildfiles toolbar button, then choose your build.xml file, if it is not a valid build file, you may see an error message "Unable to parse as an ant build file".

Once you fix your build.xml file, the Run As ant RMB command on the build.xml file will appear.

(above was my experience on Eclipse Mars.2)

cropredy
  • 111
  • 4
0

Follow the below steps.

Go to Windows -> Preferences -> General -> Content Types -> Text -> XML -> Ant BuildFile.

Just click on Add button and add your AntBuild file. click ok.

Restart your Eclipse.

0

Follow the below steps.

Go to Windows -> Preferences -> General -> Content Types -> Text -> XML -> Ant BuildFile.

Just click on Add button and add your AntBuild file. click ok.

0

Workaround: Open the ANT-View, add the build file and start it from there.

(Had the problem in JBDS8 after installing IBM Diagnostics Tools)

Thomas
  • 624
  • 11
  • 28