I wasn't aware Eclipse could generate Ant files from Eclipse builds - I know other IDEs can do it though. And I think the JBoss IDE plugin can do it. So I think you just create your build file and run it as an external tool.
Originally posted by JiaPei Jen: Thanks. I have viewed the Eclipse Help --> Workbench User Guide --> Concepts --> External Tools --> Ant Support.
The documentation has answered many of my questions.
But, the documentation does not seem to explain how to "create" an ANT file (I suppose it is always called build.xml) within the Eclipse.
Do I simply use the Eclipse editor and type up my ANT script and save it as build.xml? And then put this file to the ANT classpath under the Eclipse Window > Preferences > Ant > Runtime?
An Ant buildfile doesn't have to be named build.xml - that's just the default name, although I don't know offhand how to let Eclipse know that a file with some other name should display the Ant context menus when right-clicked.
There's no Eclipse toll I know of to build Ant build.xml files, but then Eclipse can do simple builds automatically, so unless you have a custom build process (or are like me and always support IDE-free builds), you don't need Ant.
You don't have to put the build.xml in anyone's CLASSPATH ever, Eclipse or no Eclipse. Ant reads this file as a data file when it's invoked. However, the Eclipse IDE allows you to set Ant context info for use when invoking Ant under Eclipse. It allows Ant in Eclipse to get the same benefits you'd have when running it from the command line where you'd possibly select an alternate target, set up override properties, have an extensive external build CLASSPATH and so on.
An IDE is no substitute for an Intelligent Developer.
Joined: Nov 19, 2000
According to your advices, I can use the Eclipse as an "editor" to write my own build file and save it with a name "build.xml".
Then, right mouse button on the file in the Eclipse Package Explorer View, select Run Ant from the pop-up menu, clicking the appropriate target, and clicking the Run button.
Or I simply click on the red brief case in the Eclipse tool bar, select Run As from the menu, and click on Ant build?
Please let me know if I have got the idea. Thanks.
Just try. Doesn't matter too much. The red box is to start ant as an external tool (run in a different VM then eclipse itself). As long as your build won't be too big internal is ok. If you create files in the project itself, don't forget to refresh the projects view (F5). This one confused me in my playing with xdoclet this week.
I think you can open files with other names than build.xml through ant view (via window/show view).
In the newer Eclipse 3.1 milestones you get ant debugging as an aditional feature.
Axel [ March 04, 2005: Message edited by: Axel Janssen ]
I think so. When I open "External Tools" in Eclipse (Run>External Tools>External Tools...) I see "Ant Build" in my list of configurations - here I can create a new one, pointing it at my already created [whatever].xml build file and run it. [ March 04, 2005: Message edited by: Paul Sturrock ]