Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Eclipse and ANT

 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Probably. But your first port of call should be the Ant integration documentation in the Eclipse help docs which ship with the product.
 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18154
52
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
JiaPei Jen
Ranch Hand
Posts: 1309
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2166
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 10336
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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 ]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic