wood burning stoves 2.0*
The moose likes IDEs, Version Control and other tools and the fly likes Eclipse and ANT Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "Eclipse and ANT" Watch "Eclipse and ANT" New topic
Author

Eclipse and ANT

JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
I have the Eclipse 3.0.1 and the ANT 1.6.2. Is there any online instruction on using the ANT under the Eclipse?
[ March 03, 2005: Message edited by: JiaPei Jen ]
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

Probably. But your first port of call should be the Ant integration documentation in the Eclipse help docs which ship with the product.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
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?

Thanks.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

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.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15950
    
  19

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?

Thanks.


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.


Customer surveys are for companies who didn't pay proper attention to begin with.
JiaPei Jen
Ranch Hand

Joined: Nov 19, 2000
Posts: 1309
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.
Axel Janssen
Ranch Hand

Joined: Jan 08, 2001
Posts: 2164
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 ]
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336


Please let me know if I have got the idea.


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 ]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Eclipse and ANT
 
Similar Threads
Eclipse with Ant
Ant plug in for eclipse
Problem in runnin ant build file from eclipse
Eclipse and EAR projects
Eclips error