Generates Eclipse projects to be just imported and used easily.
It is recommended to run this task together with synchronization of a sources on a developer's workstation with the central source code repository to have the Eclipse project always up-to-date.
A formerly existing Eclipse project will be overwritten if a new one is to be generated. Files for an Eclipse project are not generated if they exist and they are not older than the Ant build script (the Ant build script has not been changed). This update can be forced, however.
Element | Attribute | Description | Required | Default value |
eclipse | Top level element of the task with the general configuration. | Yes | ||
mode | Type of a project to generate. Acceptable are values "java" for JDT (Java) or "ajdt" for AJDT (AspectJ). | Yes | - | |
updatealways | Sets if the generated files are to be written always or only if the Ant build script has been changed. | No | false | |
failonerror | Stop the build process if the generation fails. | No | true | |
errorproperty | The name of a property in which the return code of the command should be stored. Only of interest if failonerror=false. | No | - | |
destdir | The directory to create an Eclipse project in. | No | base directory ot the Ant project | |
eclipse/project | Defines the file .project. At most one element is allowed. | No | no file to create | |
name | The name of the Eclipse project. | No | name of the Ant project | |
eclipse/classpath | Defines the file .classpath. At most one element is allowed. | No | no file to create | |
eclipse/classpath/container | Defines the JRE container. At most one element is allowed. | No | "org.eclipse.jdt.launching.JRE_CONTAINER" | |
path | Java classes for the JRE container. If there is no slash (/) in the path and the path does not begin with "org.eclipse.jdt.launching.JRE_CONTAINER" it will be considered relative and the string "org.eclipse.jdt.launching.JRE_CONTAINER/ org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/" will be prepended in front of it. | No | "org.eclipse.jdt.launching.JRE_CONTAINER" | |
eclipse/classpath/output | Defines output for compiled classes. At most one element is allowed. | No | root directory of the project | |
path | Directory relative to the project root. | Yes | - | |
eclipse/classpath/source | Defines references to Java sources. Multiple elements are allowed. | No | root directory of the project | |
path | Directory or file with sources relative to the project root or a reference to another project. Either this or pathref must be defined. | Yes | - | |
pathref | Identifier of a path element with directories or files with sources. Either this or path must be defined. | Yes | - | |
excluding | List of project-relative paths to be excluded from the source path delimited by vertical lines (|). | No | - | |
output | Directory relative to the project root overwriting the project-wide output. | No | project-wide output directory | |
eclipse/classpath/library | Defines references to directories or Java archives with compiles classes. Multiple elements are allowed. | No | no dependency | |
path | Directory or Java archive with compiled classes relative to the project root or a reference to another project. Either this or pathref must be defined. | Yes | - | |
pathref | Identifier of a path element with directories or Java archives with compiled classes. Either this or path must be defined. | Yes | - | |
exported | If the referred compiled byte-code is to be exported during the jar-file generation. | No | false | |
source | Directory or Zip archive with source code for the binary dependency. | No | - | |
javadoc | Directory or Zip archive with generated HTML javadoc documentation for the binary dependency. | No | - | |
eclipse/classpath/variable | Defines references to directories or Java archives with compiles classes using variables defined in Eclipse in the front of paths. Multiple elements are allowed. Attributes are the same as in the element library. | No | no dependency | |
eclipse/settings | Defines plugin-specific files in the directory .settings. At most one element is allowed. | No | no files to create | |
eclipse/settings/general | Defines a file with properties. This is the lowest-level interface to create file with properties. Other elements offer more convenient plugin-specific interface. Every file (the convenient ones below too) includes a property "eclipse.preferences.version" by default set to "1". It can be changed by an appropriate element "variable". Multiple elements are allowed. | No | no file to create | |
name | Name of the file to be created. | Yes | - | |
eclipse/settings/general/ variable | Defines a property assignment. Multiple elements are allowed. | No | no line with a property assignment | |
name | Name of the property. | Yes | - | |
value | Value of the property. | Yes | - | |
eclipse/settings/resources | Defines the file "org.eclipse.core.resources". At most one element is allowed. The element "variable" from the element "general" is supported for the low-level creation of properties. | No | no file to create | |
encoding | Encoding of resources (variable "encoding/<project>"). Allowed values are: "ISO-8859-1", "US-ASCII", "UTF-16", "UTF-16BE, "UTF-16LE", "UTF-8". | Yes | - | |
eclipse/settings/runtime | Defines the file "org.eclipse.core.runtime". At most one element is allowed. The element "variable" from the element "general" is supported for the low-level creation of properties. | No | no file to create | |
encoding | Marker for the end of line (variable "line.separator"). Allowed values are: "unix", "macintosh", "windows". | Yes | - | |
eclipse/settings/jdtcore | Defines the file "org.eclipse.core.jdt.core". At most one element is allowed. The element "variable" from the element "general" is supported for the low-level creation of properties. | No | no file to create | |
compilercompliance | Version of the Java compile to be compliant with (variable "org.eclipse.jdt.core.compiler.compliance"). Allowed values are: "1.3", "1.4", "5.0", "6.0". The following properties are set to their default values by providing this variable: "org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode", "org.eclipse.jdt.core.compiler.codegen.targetPlatform", "org.eclipse.jdt.core.compiler.codegen.unusedLocal", "org.eclipse.jdt.core.compiler.compliance", "org.eclipse.jdt.core.compiler.debug.lineNumber", "org.eclipse.jdt.core.compiler.debug.localVariable", "org.eclipse.jdt.core.compiler.debug.sourceFile", "org.eclipse.jdt.core.compiler.problem.assertIdentifier", "org.eclipse.jdt.core.compiler.problem.enumIdentifier", "org.eclipse.jdt.core.compiler.source". See the table below. They can be changed by adding an element "variable" with their name. | Yes | - | |
eclipse/settings/jdtui | Defines the file "org.eclipse.core.jdt.ui". At most one element is allowed. The element "variable" from the element "general" is supported for the low-level creation of properties. | No | no file to create | |
compliance | Compliance of project settings (variable "internal.default.compliance"). Allowed values are: "user", "default". | No | "user" |
Here we are default values for properties in the file ".settings/org.eclipse.core.jdt.core" defined by the element "eclipse/settings/jdtcore".
Property / compilercompliance | 1.3 | 1.4 | 5.0 | 6.0 |
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode | enabled | enabled | enabled | enabled |
org.eclipse.jdt.core.compiler.codegen.targetPlatform | 1.1 | 1.2 | 1.5 | 1.6 |
org.eclipse.jdt.core.compiler.codegen.unusedLocal | preserve | preserve | preserve | preserve |
org.eclipse.jdt.core.compiler.compliance | 1.3 | 1.4 | 1.5 | 1.6 |
org.eclipse.jdt.core.compiler.debug.lineNumber | generate | generate | generate | generate |
org.eclipse.jdt.core.compiler.debug.localVariable | generate | generate | generate | generate |
org.eclipse.jdt.core.compiler.debug.sourceFile | generate | generate | generate | generate |
org.eclipse.jdt.core.compiler.problem.assertIdentifier | ignore | warning | error | error |
org.eclipse.jdt.core.compiler.problem.enumIdentifier | ignore | warning | error | error |
org.eclipse.jdt.core.compiler.source | 1.3 | 1.3 | 1.5 | 1.6 |
This is the minimum configuration of a project with a single source directory.
<eclipse> <project /> <classpath> <source path="src" /> <output path="bin" /> </classpath> </eclipse>
This is an example how to force usage of a 1.3 compiler. There must be a JRE registered with the name "JDK 1.3.1" in the Eclipse configuration.
<eclipse> <settings> <jdtcore compilercompliance="1.3" /> </settings> <project /> <classpath> <container path="JDK 1.3.1" /> <source path="src" /> <output path="bin" /> </classpath> </eclipse>
This is an example how to declare a dependency on another project name "MyLibrary" and how to refer all classes from a classpath "classpath" declared in the build script using the element "path".
<eclipse> <project /> <classpath> <source path="src" /> <source path="/MyLibrary" /> <library pathref="classpath"/> <output path="bin" /> </classpath> </eclipse>
Copyright © 2005-2006 Ferdinand Prantl. All rights reserved.