Skip to Content

Overview

Ant4Eclipse provides a set of Ant-tasks that you can use to access and process your Eclipse project settings from your Ant buildfiles. Using ant4eclipse you can write build scripts that are driven by the configuration you made for your projects in Eclipse without to duplicate your configuration (like a projects classpath, its output- and source folders) in Eclipse and in Ant.
The Ant4Eclipse task can be grouped into three categories:

  • Executors: Executors are special tasks that directly "work" on a special workspace or project artifact (an artifact might be a single project or a launch configuration etc). An Executor passes all information about such an artifact (like it's name, it's location, it's classpath etc - depending on the concrete artifact) to "sub-tasks" in your build file. You can implement those sub-tasks (that work like callback methods in a programming language) in your build file to process the artifact (for example to compile the current project). You can learn more about Executors here
  • Tasks: Ant4Eclipse-Tasks are technically regular Ant tasks, that allow you to read configurations from your Eclipse projects and make them available to your build file via Ant properties, pathes, references etc. In opposite to Executors when using tasks you explizitly "ask" for a specific information while an Executors provide all important information automatically for you.
  • Conditions: Ant4Eclipse shipps with several Ant-Conditions that can be used to determine if a project has a specific setting (for example if it has a specific nature). You can use them for example with the if-task, that is part of the antcontrib project.

Macros

In additions to the tasks mentioned above ant4eclipse comes with a set of macros that provide out-of-the-box-solutions for some common tasks (like compiling a whole java project or building a plug-in). The macros can be found in several xml-files inside the "macros" subfolder in the ant4eclipse distribution. (Note: of course the macros are using the ant4eclipse tasks so they are a good demonstration of their usage).

Where is the Eclipse configuration?

Ant4Eclipse directly works with your project configuration thus eliminating the need of re-configuration your setup in your build file. Your Eclipse project setting completely drives your build. But there are some configurations that are not part of your project, but part of the workspace or Eclipse preferences. The JREs you define in Eclipse for example are stored in the .metadata directory in your workspace. If you make a clean checkout of your project (for example in a nightly build), these informations are not available (to ant4eclipse) and need to be re-configured in ant4eclipse. Anyway that is pretty straight forward and we’ll show you in the following sections how you do this.