<buildPlugin>

Scope: Plug-in Projects

Description

This task builds Eclipse plug-in projects. It reads the information from the MANIFEST- and the build.properties-file and builds the plugin according to their settings.

Arguments

Argument Description Required
project Path to the plugin project that should be built. Either the project or workspace and projectName has to be specified
workspace Path to the workspace containing the projects
projectName Name of the plugin project inside of the workspace that should be built.
destDir Name of the directory that will contain the plugin after building (same as the "Destination directory" in the PDE-Export wizzard in Eclipse). The plugin will be built in to destDir/plugins/pluginName . While the destDir has to exist, the plugins/pluginName directory will be created by ant4eclipse if not existing. yes
packageAsJar If set to true the feature will be packaged as a jar file. Otherwise it will be an exploded directory no (defaults to false)
variablesRef The ID of an ant property set. This property set will be used to resolve Eclipse variables. This allows to prefer a specific set of properties rather than using the ant properties in general. no
targetPlatformLocation Full path to the target platform location that contains all the plugins against which the workspace plugins will be build. Has to point to the directory that contains the 'plugin'-directory (e.g. c:\eclipse). no (defaults to the workspace directory). As an alternative you can define a target platform using the nested targetPlatform element

Parameters specified as nested elements

targetPlatform

If you want to define a target platform that has more than one directory you have to use the targetPlatform element. See targetPlatform reference for more information on how to use the target platform type

Choosing a compiler to use

Using the buildPlugin task you can deceide which java compiler you want to use to compile your plugin. Currently there are two compilers available: the javac compiler and the Eclipse Compiler for Java (ecj) that is available from the Eclipse homepage.

The compiler to use can be chosen by using the appropriate compiler-element listed below. If you don't specify one of the two available compiler ant4eclipse will try to use the Eclipse compiler. If that compiler is not available it will fail. In that case you explizitly have to set the javacLibraryCompiler to make ant4eclipse use the javac compiler.

Thats because we strongly recommend the usage of the Eclipse compiler since ant4eclipse offers a lot more functionality using this compiler. Using ecj ant4eclipse will take your MANIFEST settings (import-package and require-bundle) into account when trying to compile your bundle: if - for example - your plugin uses a class from a package that is available somewhere on the classpath, but is not explizitly imported in your MANIFEST the compilation will fail (as an OSGi runtime framework would do, too). When using the javac compiler ant4eclipse will also resolve the required bundles according to the OSGi specification, but will not fail if you use a class in your bundle that should be invisible due to OSGi restrictions.

NOTE: You can only specify one of eclipseLibraryCompiler or javacLibraryCompiler elements.

eclipseLibraryCompiler

To use the eclipse compiler you'll have to download it from the Eclipse homepage. The compiler is shipped as a single jar file (ejc.jar) and must be copied to the lib directory of your ant installation. The compiler is available from http://download.eclipse.org/eclipse/downloads/. Choose an Eclipse version (currently, ant4eclipse is tested against the compiler from Eclipse 3.2) and you'll find the compiler in the "JDT Core Batch Compiler" section).

Argument Description Required
useProjectCompilerSettings If set to 'true' the your project-specific compiler settings (from the org.eclipse.jdt.core.prefs file) will be used to configure the compiler if availabe. Otherwise the default compiler settings will be used no (defaults to 'true')

javacLibraryCompiler

The javacLibraryCompiler doesn't take any parameters but can take a nested element itself to configure it: the compilerSettings elements. Using this element you're able to set some of the configuration parameters, Ant's own javac task allows you to set except those dealing with the files to compile and the classpath, since they are set by ant4eclipse according to your project settings.

The following parameter from the ant tasks are not supported: srcdir, destdir, includes, includesfile, excludes, excludesfile,classpath,sourcepath,bootclasspath,classpathref,sourcepathref,bootclasspathref,extdirs, source and target

In opposite to Ant's javac task the parameter includeAntRuntime is set to false by default.

The source and target are set to the values specified specified in the build.properties using the javacSource and javacSource properties which are set to "1.3" resp. "1.2"

Example:

Examples

The following example shows how to use the buildPlugin task.