tags:

views:

1011

answers:

3

Using eclipse 3.3.2 with MyEclipse installed. For some reason if a file isn't called build.xml then it isnt' recognised as an ant file. The file association for *.xml includes ant and says "locked by 'Ant Buildfile' content type.

The run-as menu is broken. Even if the editor association works run-as doesn't.

The ant buildfiles in question are correctly formatted. They work fine if you call them build.xml or if you use them anywhere else. Eclipse just won't recognise and thus wont allow you to run them.

A: 

If you open the "File Associations" page (Window -> Preferences -> General -> Editors -> File Associations) you should see a list of all file types which Eclipse recognises. Scroll down to the "*.xml" entry, highlight "Ant Editor" in the "Associated Editors" pane and hit the "Default" button on the right-hand side. Eclipse should now open any XML files with the ant editor.

Ashley Mercer
+1  A: 

The environment inspects the file contents to determine if it is an Ant file (if it isn't called "build.xml"). Add the following to the XML file:

<?xml version="1.0" encoding="UTF-8"?>

<project name="myproject" default="t1">
    <target name="t1"></target>
</project>

You should now see the "Ant Editor" in the "Open With >" menu when you right-click on the file.

McDowell
A: 

I was having a similar problem and found that the Ant Tools weren't included in the Eclipse binary I downloaded. You can try installing the Eclipse Java Development Tools. These can be found under Java Development > Eclipse Java Development Tools in Help > Software Updates > Available Software.

Brian Fisher