Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Mail Systems
Eclipse Documentation

How To Guides
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Problem Solutions
Privacy Policy




Eclipse Platform Plug-in Development Environment Guide
Previous Page Home Next Page

Feature and Plug-in custom build steps

New in 3.2 is the ability for a feature or plug-in to contribute custom custom steps to its own build.  These custom steps can be used for things like instrumenting byte-code after compilation, indexing help files for documentation, or copying extra files into the bundle. 

To use custom targets, a feature or plug-in must define the property customBuildCallbacks in its file; the value of this property is the location of an xml file, relative to the root of the feature/plug-in, containing the custom targets. If the xml file is located elsewhere, use the property customBuildCallbacks.buildpath to set the directory to use.

Templates named customBuildCallbacks.xml containing the supported custom targets are provided in and respectively.  These templates can be copied into your feature/plug-in and modified as needed.

The custom targets will be invoked using the subant task; by default, failonerror is set to false. To change this set the property customBuildCallbacks.failonerror to true. Similarly, the inheritall parameter defaults to false. Set the property customBuildCallbacks.inheritall to change this.


The generated build.xml that builds a plug-in contains several targets that perform specific tasks.  PDE Build allows the plug-in to provide custom pre and post targets that will be called before and after specific tasks.  In addition to any ant properties that may already be defined, each custom target may also be passed a couple of specific properties.  The following targets support custom callbacks:

  • build.jars:  The build.jars target will invoke in turn each of the compilation targets that will be built for this bundle.  It supports and targets which are called before and after all the compilation targets are called.  Both the pre and post targets are provided with the property build.result.folder which is the folder to which the results of the build will be copied.
  • Compilation Targets:  The build.xml defines a compilation target for each jar being built (eg @dot for the bundle itself, or library.jar).  Each compilation target supports 3 custom callbacks:
    • pre.<compilation target>:  Called before source files are compiled.  It is provided with the following properties:
      • target.folder:  The folder where the compiled class files will be placed
      • source.folder<N>:  The source folder(s) containing the source to be compiled.  (eg source.folder1, source.folder2, etc).
      • <compilation target>.classpath:  A reference to the ant path structure containing the classpath that will be used in the compilation.  (eg @dot.classpath, library.jar.classpath). The reference to the classpath should be used with a refid.
        <classpath refid="library.jar.classpath"/>
        <property name="mypath" refid="library.jar.classpath" />
    • post.compile.<compilation target>:  Called after the source is compiled, but before the class files are jared or copied into the build result folder.  It is provided with the same properties as the pre.<compilation target> target.
    • post.<compilation target>:  Called at the end of the compilation target after the results are copied to the build result folder.  It is provided with the following properties:
      • jar.Location:  The jar or folder containing the compilation results.
      • <compilation target>.classpath:  A reference to the ant path structure containing the classpath that was used in the compilation.
  • build.sources:  This target builds the source zips for each of the compilation targets.  It supports and targets.  Both of these targets are provided with the property build.result.folder which is the folder to which the source zip files will be copied.
  •  This target copies the build results (ie the jars and any other files being included in the bundle) to the final destination directory.  It is also the target where the version qualifiers are replaced in the manifest file (see  VersionQualifiers). It supports and targets.  Two properties are provided to the pre and post targets:
    • build.result.folder:  the folder containing the results of the build
    • target.folder:  the destination folder to which the build results and bundle contents are being copied.
  • gather.sources: This target gathers the source zips for the bundle.  It supports pre.gather.sources and post.gather.sources targets.  Both the pre and post targets are provided with the target.folder property which is the folder that the sources are being copied to.
  • gather.logs:  This target collects the log files from the build.  It supports pre.gather.logs and post.gather.logs.  Both the pre and post targets are provided with the destination.temp.folder which is the temporary folder that the logs files are being copied to.
  • clean:  This target performs a clean, it supports pre.clean and post.clean targets.  The pre and post targets have the following properties:
    • plugin.destination:  The folder that the final bundle was copied to.
    • build.result.folder:  The folder that the results of the build were copied to
    • temp.folder:  The temporary folder where results were staged before being copied to the final desination.


The generated build.xml for features only supports custom build callbacks for the target.  This target will invoke that target of all the included features and plug-ins.  It supports and  Both of these targets are provided with the following properties:

  • destination.temp.folder:  The directory to which the plugins will be copied.
  •  The directory to which the files for this feature will be copied.

  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire