Eclipse 3.1 ANT Build File Import/Export
What's New in Eclipse 3.1
— Since Eclipse's first release in 2001, it has become a popular environment for Java development. In the period between March 10 and May 11, 2005, users downloaded over 17,000 copies of one of the production SDK releases and over 3,500 copies of one of the stable (milestone) SDK builds on average every day. A vibrant eco-system of developers, plug-in providers, authors, and bloggers has grown up around it. Eclipse has also gained the backing of the key Java vendors including BEA, Borland, IBM, SAP, and Sybase. Developers like Eclipse because it provides a great platform for building Java applications, and companies like it because it unifies their software tools under one open source umbrella.
I was reading this article on JDJ about new features in Eclipse 3.1. One feature mentioned that caught my eye was the ability to set a project based on an existing ANT build file, and the ability to export a project settings to an ANT build file. Unfortunately the article didn't explain how to do this import/export. I searched Eclipse's help, to no avail. After some messing around with eclipse I found out how to do it.
To export your project settings to an ANT build file:
- Right click on any file in your project and click on "export" (thanks to Scott Stanchfield for clarifying that any file in the project will do).
- On the window that pops up, select "Ant Buildfiles" and click on "next".
- Select the appropriate project to use to generate the ANT buildfile.
- Click "finish".
Any custom targets you create should go on build-user.xml, since build.xml will be overwritten every time a build file is generated.
To create a project from an existing ANT buildfile:
- Click on File->New->Project
- Select "Java Project from existing Ant Buildfile" and click "next".
- Enter a project name, and select the build file to use to create the project.
- Select the javac declaration to be used to define the project.
- Click "finish".