Aaron
Aaron

Reputation: 881

How do I get eclipse to edit *build.xml as an ant build file

I am running eclipse Indigo. I have some build files that are NOT named build.xml How do I update the eclipse config so that eclipse will treat these as ant build files.

I have looked at Preferences-> General -> Content Types -> Text -> XML-> Ant Buildfile And I tried to add *build.xml, but I had an error

The file name cannot include the wild card character (*) in the current location

Used to be when I looked at the Outline view of the build.xml I had a nice hierarchy (File was recognized as Ant Build). That is no longer working. Now I get "An outline is not available". The most recent change was downloading all of oracle's plugins so I could run a local app server.

Right clicking on the file to explicitly choose Ant editor works. (Thanks Alex)

Any suggestions on how to get eclipse to recognize these files as build files instead of standard xml files? I miss the single click opening.

Upvotes: 2

Views: 2791

Answers (1)

MikkolidisMedius
MikkolidisMedius

Reputation: 4844

In eclipse, you cannot associate complex filenames with editors (there's a bug opened for this functionality but has not been implemented thus far, https://bugs.eclipse.org/bugs/show_bug.cgi?id=89859).

You can only associate complete filenames (like build.xml) or simple wildcards like *.xml.

An easy way to work around this is using a special extension for your ant files (Eclipse already comes pre-configured with support for *.ant or *.ent files). So the simplest way is renaming your build scripts to use .ant as extension. Depending on your situation, this can be a solution.

If you cannot renames files for whatever reason, then the only solution is to associate each file individually to the ANT editor. You can do this, as suggested, by right-clicking the file and choosing Open With -> Ant Editor. Eclipse will remember your choice the next time you open the same file.

Upvotes: 1

Related Questions