Skip to main content

Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Modeling Project Releng/Building

  • We use the Eclipse build process which relies on PDE. See this article if you are interested in the details. It also covers the JUnit automated tests that can be run during the build.
  • You can use PDE to configure what will appear in your zips.


Contents

Incubation Status

In order to comply with Eclipse.org's Incubation Rules, EMFT components must adhere to these 3 rules.

For example, here are the changes required to make EMF Compare compliant: Search CVS results

1. All downloadable zip files for builds and milestones must include the word incubation in the filename. For example, emft-compare-SDK-incubation-N200708031343.zip. The jar files in the download zip file are NOT required (bug 178944) to contain the word incubation in the filename.
To change your build to provide -incubation in the zip names, search your .releng project for ".zip" and fix all files accordingly. Releng Example
  • Building: customTargets.xml (all versions of this file)
  • Testing: relengbuildgtk.sh, testManifest.xml, testManifest.xml.template, testing.properties, readme.html
  • Promoting: promoteToEclipse.*.properties
2. All Bundle-Names must include the word incubation. Note that Bundle-SymbolicNames should not include incubation because the Bundle-SymbolicName is a technical namespace, not a user namespace. For example, Bundle-Name: Foo Plug-in (Incubation).
Update all your component's MANIFEST.MF and/or plugin.properties files, including tests, examples, and doc (which file to edit depends on where "Bundle-Name" strings are located). MANIFEST.MF Example
Bundle-Name: %pluginName (Incubation) [1]
3. The names for update manager features must include the word incubation. For example, EMF Compare Documentation (Incubation).
Update all your component's feature.xml and/or feature.properties files, including tests, examples, doc, and SDK features. Add (Incubation) to both the feature label and the feature description. Feature.* Example
<feature
     id="org.eclipse.emf.compare.sdk"
     label="EMF Compare SDK (Incubation)"
     version="0.7.0.qualifier"
     provider-name="Eclipse.org">
  <description>
     EMF Compare SDK includes runtime, source, and documentation (Incubation)
  </description> [2]
4. In order to correctly generate the label for your update site categories/features, your promoteToEclipse.*.properties file must correctly reference your zips with "incubation" in their title. For example:
# used to determine the actual name of the SDK zip (when builds are aliased)
SDKfilenamepattern="$projectName-$subprojectName-SDK-incubation-*.zip"
# zips to unpack for UM jar generation
filePrefixesToUnzipArray=( "$projectName-$subprojectName-SDK-incubation-" "$projectName-$subprojectName-examples-incubation-" );

When a project exits incubation, above changes should be reversed to remove the incubation identifiers from features, plugins, and zip file names.

Customizing Zip Bundles

In the event that you have plugins or features that PDE will not normally bundle together, such as .ui plugins in the runtime zip, you will need to adjust the way PDE behaves in order to ensure all your plugins/features appear in your zips as you need them. If you need a custom zip, like EMF has for Models or Standalone, this is also how you can accomplish this.

There's two ways to customize what gets put into a zip bundle by PDE: the correct way (a) and the shortcut (b)

Option A

The first method involves creating a feature which sets up the included features/plugins that have to be in there, as with .sdk features in the EMFT subprojects (ocl, query, validation, transaction). See details in CVS. An example of this is org.eclipse.emf-feature/org.eclipse.emf.sdk. It is nested (rather than being its own org.eclipse.emf.[subproject].[bundlename]-feature) for cosmetic reasons (it looks in the file system).

When creating a new org.eclipse.emf.[subproject]-feature/org.eclipse.emf.[subproject].[bundlename] (or org.eclipse.emf.[subproject].[bundlename]-feature), you will need to ensure it's properly connected to the build harness in 3 ways:

1. First, you'll need a folder under your builder/ directory for the feature build, such as:
org.eclipse.emft/releng/validation/builder/sdk/

Into this folder must go a customTargets.xml and a build.properties file. Then make sure that customTargets.xml refers to the feature correctly, as in customTargets.xml. (Search for "sdk" on lines 9, 20, 187.)

2. Then, the buildAll.xml script must be told how to build the new zip, eg, buildAll.xml (line 139):
<target name="buildAll" depends="init">
  <ant antfile="build.xml" target="main">
    <property name="component" value="builder/sdk"/>
  </ant>
  ...
</target>
3. And finally, you need to add the custom feature to the mapfile & mapfile template, since it won't be generated by PDE into the mapfile automagically. Examples: org.eclipse.emft/releng/validation/maps/validation.map
org.eclipse.emft/releng/validation/templateFiles/validation.map.template

Add an entry such as (line break added for clarity):
feature@org.eclipse.emf.validation.sdk=@cvsTag@,@cvsRoot1@,,org.eclipse.emft/validation/plugins/ org.eclipse.emf.validation-feature/org.eclipse.emf.validation.sdk

Option B (or adding an optional dependency)

The second method is faster (and, arguably, more hackish). This is also a valid method for adding an optional dependency, like for example adding optional support for OCL.

Instead of one feature per zip, as above, you can have custom instructions/rules in the buildAll.xml script which allow you to copy extra files that would normally be excluded from the zip to clean up missing content. These instructions are kept in one place (ie., only one ant script), so maintenance is easier, but this solution should only be used to add files to existing bundles, not to create new, custom ones.

For example, there's a validation.ocl plugin which must be included in the validation runtime, but since the validation-feature makes no mention of it, it's excluded. So, to work around this, once the SDK is built, copy the validaton.ocl plugin & feature from the SDK zip to the runtime zip after its assembly. This is done in the org.eclipse.emft/releng/validation/buildAll.xml script:

<target name="buildAll" depends="init">
  <ant antfile="build.xml" target="main">
    <property name="component" value="builder/sdk" />
  </ant>
  
  <ant antfile="build.xml" target="main">
    <property name="component" value="builder/runtime" />
  </ant>
  ...
  
  <!-- add .ocl feature + plugin from SDK to runtime -->
  <zip update="true"
    destfile="${buildDirectory}/${buildLabel}/emft-${subprojectName}-runtime-${buildAlias}.zip">
    <zipfileset 
      src="${buildDirectory}/${buildLabel}/emft-${subprojectName}-SDK-${buildAlias}.zip">
      <include name="**/org.eclipse.emf.${subprojectName}.ocl*"/>
      <include name="**/org.eclipse.emf.${subprojectName}.ocl*/*"/>
    </zipfileset>
  </zip>
  ...
</target>

Bear in mind that you must ensure that everything you need to compile is available. You will need to edit all the customTargets.xml files that are used to build code which depends on the new reqiurement. See target "postSetup".

<ant target="getDependency" antfile="${getDeps.xml}">
   <property name="url" value="${oclURL}"/>
   <property name="file" value="${oclFile}"/>
   <property name="isUnpackedFile" value="${buildDirectory}/plugins/org.eclipse.emf.ocl/plugin.xml"/>
</ant>

If your tests require addtional plugins in order to compile or run, be sure to add them to your test.xml file. See target "setup".

Where are ${fooURL} and ${fooFile} defined?
  • Parameters are set in your build's generated build.cfg file.
  • That file's contents are generated using genBuildDetails.sh, which is where you can add other defined targets.
  • genBuildDetails.sh is called from start.sh, which is what starts the build.
  • Note that after updating genBuildDetails.sh and build-common.php you'll need to update the build machine following Maintaining CVS Synch. Even still, you'll need to run a build adding the URL of the new dependency before a placeholder will appear in the dependencies list.

Using PDE Packager

PDE Build provides a way to repackage existing (pre-built) features into arbitrary archives. This is useful if you want to build zip files with several top-level features (rather than just one feature). See Repackaging Eclipse Components for more information.

In order to use this tool you should have an existing build process that produces a single "master" feature zip with all features/plugins that you want to use as a starting point for repackaging. Configuring the packager is similar to configuring the builder: you will need a packager configuration directory for each package you want to produce. For instance, Mint's SDK package contains packager.properties (as opposed to build.properties), packaging.properties, and customTargets.xml. All three are very template-like, but you need to make the following changes for your specific configuration:

1. In packager.properties, change property archiveNamePrefix to customize the name of your zip file (the final name is set in customTargets.xml to ${archiveNamePrefix}-${buildAlias}.zip) and set property featureList to a comma-separated list of IDs of the features you want to include in the archive.
2. Optionally, update packaging.properties to include additional files in the root of the archive.

In order to run the packager you must make some changes to your master build file:

1. Add a package target that runs a particular packager configuration:
<target name="package">
   <ant antfile="package.xml" dir="${eclipse.pdebuild.scripts}">
      <property name="packagingInfo" value="${basedir}/${packagingInfo}" />
      <property name="assemblyTempDir" value="${buildDirectory}/jartmp" />
   </ant>
</target>
2. Add a getDependency target that fetches your build dependencies into a temporary directory:
<target name="getDependency">
   <ant antfile="${buildDirectory}/../org.eclipse.modeling.common.releng/scripts/getDependenciesHelper.xml" target="unpackBundle">
      <property name="unpackDest" value="${tempDirectory}"/>
   </ant>
</target>

This is required in order to manually build up your target platform that is used during packaging (much like for building, except everything must be in the binary form rather than source).

3. Populate a target directory with all your built features/plugins as well as their dependencies. The dependencies should technically not be needed at this point, but the packager requires them in order to function properly. E.g.,
<property name="baseDirectory" location="${buildDirectory}/../packaging"/>
<property name="tempDirectory" location="${baseDirectory}/temp"/>
<antcall target="getDependency">
   <param name="url" value="${eclipseURL}" />
   <param name="file" value="${eclipseFile}" />
   <param name="isUnpackedFile" value="${tempDirectory}/eclipse/plugins/org.eclipse.platform.doc.isv/plugin.xml" />
</antcall>
<antcall target="getDependency">
   <param name="url" value="${emfURL}" />
   <param name="file" value="${emfFile}" />
   <param name="isUnpackedFile" value="${tempDirectory}/eclipse/plugins/org.eclipse.emf.ecore/plugin.xml" />
</antcall>
<unzip src="${buildDirectory}/${buildLabel}/${allZip}" dest="${tempDirectory}">
   <patternset excludes="eclipse/*"/>
</unzip>
<unzip src="${buildDirectory}/${buildLabel}/${allZip}" dest="${tempDirectory}/common.common.common">
   <patternset includes="eclipse/*"/>
</unzip>

Make sure you do this *after* all your jars have been signed; otherwise your zip will contain unsigned jars (and go ahead, ask Bjorn if that's OK ;-) )

4. Replace all your zip tasks that build your sdk/runtime/example archives with a corresponding call to the packager:
<antcall target="package">
   <param name="packagingInfo" value="builder/sdk/packager" />
</antcall>
5. Lastly, move the code to build your tests *before* you run the packager, but *after* you build the master zip. This is required due to Bug 240716 -- the master builder sets the output form of all features to be jars while the packager needs them to stay unpacked (i.e., directories). This bug causes the first setting to remain in effect and your packager will produce jarred features, unless another builder resets it (e.g., the tests builder, which doesn't produce jarred features).

Using Third Party Jars

You are welcome to take advantage of third party code, but bear in mind these rules:

1. Third partycode must be submitted to IPzilla for legal clearance before being committed to CVS.
2. Many third party libraries are available via the Orbit project, and so can be added to the project at build time (rather than needing to be duplicated in CVS).
3. See also Component Creation - Code Contribution.

Using Orbit Jars

If the jar(s) you need to use are in Orbit, they're safe for use during your build and safe to be shipped with your features.

  • When building, select the latest Orbit bundle on your build page along with Eclipse, EMF, UML2, etc.
  • Then, add code such as this to the "postSetup" target of your customTargets.xml file.
 <echo message="Download Orbit Bundle ..." />
 <ant target="getBundle" antfile="${buildDirectory}/../org.eclipse.modeling.common.releng/scripts/getDependenciesHelper.xml">
   <property name="url" value="${orbitURL}"/>
   <property name="file" value="${orbitFile}"/>
 </ant>
 <echo message="Unpack selected jars ..." />
 <unzip dest="${buildDirectory}/.." src="${downloadsDir}/${orbitFile}">
   <patternset>
     <include name="**/org.apache.commons.lang*.jar"/>
     <include name="**/org.apache.commons.logging*.jar"/>
     <include name="**/org.apache.commons.cli*.jar"/>
   </patternset>
</unzip>

To ship Orbit jars with your zips, you'll need to explicitly add them into your zips.

<zip destfile="${buildDirectory}/${buildLabel}/${archiveName}" update="true">
  <zipfileset src="${downloadsDir}/${orbitFile}" includes="**/net.sourceforge.lpg.lpgjavaruntime_${LPGRuntimeVersion}.*.jar"/>
</zip>
<zip destfile="${buildDirectory}/${buildLabel}/${archiveName}" update="true">
  <zipfileset src="${downloadsDir}/${orbitFile}" includes="**/net.sourceforge.lpg.lpgjavaruntime.source_${LPGRuntimeVersion}.*.jar"/>
</zip>
  • Note that in this specific example, ${LPGRuntimeVersion} is defined in buildAll.xml and stored as a property in the generated build.cfg file so that it's accessible to all Ant scripts.

Using Non-Orbit Jars

If you need to use third party jars during your build, but don't want to (or can't) ship them due to licensing or other reasons, here's how.

PLEASE ENSURE you are not violating any EULAs or applying encroaching licenses to your EPL work by simply USING any third party jars!
  • First, download the jar(s) or zip(s) onto your build server:
[yourbox] $ wget http://path/to/foo.zip
[yourbox] $ scp foo.zip yourname@emft.eclipse.org:/tmp
 
[emft] $ sudo -u apache cp /tmp/foo.zip /home/www-data/build/3rdPartyjars/
[emft] $ rm -fr /tmp/foo.zip
If you cannot ssh to your build server (eg., emft.eclipse.org) directly, repeat the above process for scp'ing your file(s) to dev.eclipse.org, then scp those files from there to emft.eclipse.org. Be sure to delete your temp files in both locations!
<target name="postFetch">
  <replace dir="${buildDirectory}/plugins" value="${timestamp}" token="@buildid@">
    <include name="**/about.mappings" />
  </replace>

  <echo message="Copy hsqldb.jar into plugins/org.eclipse.emf.cdo.jdbc.hsqldb/lib ..."/>
  <copy 
    todir="${buildDirectory}/plugins/org.eclipse.emf.cdo.jdbc.hsqldb/lib" 
    file="${buildDirectory}/../../../../../../../downloads/hsqldb.jar" failonerror="true"/>

  <echo message="Copy mysql-connector-java-3.1.12-bin.jar into plugins/org.eclipse.emf.cdo.jdbc.mysql/lib ..."/>
  <copy 
    todir="${buildDirectory}/plugins/org.eclipse.emf.cdo.jdbc.mysql/lib" 
    file="${buildDirectory}/../../../../../../../downloads/mysql-connector-java-3.1.12-bin.jar" failonerror="true"/>
</target>
<echo message="Repack zip w/ exclusion filter"/>
<zip destfile="${buildDirectory}/${buildLabel}/emft-${subprojectName}-SDK-${buildAlias}.zip_" update="true">
  <zipfileset src="${buildDirectory}/${buildLabel}/emft-${subprojectName}-SDK-${buildAlias}.zip">
    <exclude name="**/lib/hsqldb.jar"/>
    <exclude name="**/lib/mysql-connector-java-3.1.12-bin.jar"/>
  </zipfileset>
</zip>

<echo message="Remove orig. zip and rename new one"/>
<delete file="${buildDirectory}/${buildLabel}/emft-${subprojectName}-SDK-${buildAlias}.zip"/>
<move file="${buildDirectory}/${buildLabel}/emft-${subprojectName}-SDK-${buildAlias}.zip_" 
  tofile="${buildDirectory}/${buildLabel}/emft-${subprojectName}-SDK-${buildAlias}.zip"/>

Standalone Zip Bundles

Building a Standalone Zip allows you to provide code for use outside Eclipse. This is not very well documented (yet), but to get a feel for how to build a Standalone bundle, have a look at the following EMF examples:

Build

org.eclipse.emf.releng.build/zips/standalone/
org.eclipse.emf.releng.build/buildAll.xml
org.eclipse.emf.releng.build/zips/build.xml
  (line 14, target "standalone")

Test

org.eclipse.emf.releng.build/testManifest.xml
org.eclipse.emf.releng.build/templateFiles/testManifest.xml.template
org.eclipse.emf.releng.build/tests/configs/local/customTest.xml


Build Server Directory Structure

Here's a quick snapshot of the directory structure used on the emft build server, so that you can reproduce it elsewhere.

The emft build server (emf.torolab) is running Debian 3.0 (Woody), kernel 2.4.25, with dual 2G AMD Opteron processors, 3G RAM, 1.5G swap, and 33G HD.

Path Purpose/Description
/var/www/emft/ internal web paths (build.php)
/var/www/technology/emft/ external web path mirrored to download.eclipse (downloads, etc.)
/var/www/technology/emft/build.options.txt file used by both build.php and downloads/index.php to display only those builds specified
/var/www/technology/emft/downloads/index.php where to download project zips
/var/www/technology/emft/[subproject]/downloads/ symlink to /home/www-data/build/emft/[subproject]/downloads/ (so that the downloads page can find the zips)
/home/www-data/build/emft/scripts/ build path to where shell scripts are initiated by the web (the apache1.3 user is www-data)
/home/www-data/build/emft/requests/ build path to where build.php's data (URLs and log of requests for builds) is stored
/home/www-data/build/emft/[subproject]/downloads/ where required .zips are downloaded prior to building (eg., Eclipse SDK, EMF SDK)
/home/www-data/build/emft/[subproject]/downloads/drops/ where [subproject] is built (all versions here, including any NLS zip, once available (if any))
/home/www-data/build/emft/[subproject]/downloads/drops/1.0.0/ where [subproject] v1.0.0 is built
/home/www-data/build/emft/[subproject]/downloads/drops/1.0.0/ [type][yyyymmddHHMM]/ a specific build's folder, including zips, test results, docs
/opt/ibm-java2-1.4 -> /opt/ibm-java2-ws-sdk-pj9xia32142-20050609 default build JDK / used for JUnit tests
/opt/sun-java2-1.4 -> /opt/j2sdk1.4.2_03 optional build JDK / used for EMF JDK tests
/opt/sun-java2-5.0 -> /opt/jdk1.5.0_03 optional build JDK / used for EMF JDK tests
/opt/ibm-java2-1.3 -> /opt/IBMJava2-131 used to test EMF 2.0.x ONLY
/opt/apache-ant-1.6.1 (or newer) build & utility scripts
/usr/bin/php4 (4.1.2 or newer) both Apache module and CLI (command line interface) modules required


Testing & Diagnosing Builds

To determine what's wrong with your build, make sure you're building in debug mode. eg., [3] or [4]. Then set the following parameters:

 Build Type: N (Nightly)
 Tag Build: No
 Run Tests: JUnit
 debug java home: /opt/ibm-java2-ws-sdk-pj9xia32142-20050609
 debug noclean: Y

Then, you can use the following shell commands:

# shortcut to builds folder
alias odd=' cd /home/www-data/build/emft/ocl/downloads/drops/1.0.0'

# shortcut to LATEST build folder
alias lastfolder='cd `find . -maxdepth 1 -type d -not -name \
  "." -exec date -r {} +%s\ {} \; | sort | tail -1 | \
  sed -e "s/[0-9]\+\ \.\///g"`'

alias oddl='odd; lastfolder'

# check build log
oddl; tail -60 buildlog.txt

# check JUnit test console log
oddl; cd testing/*/testing/; tail linux.gtk_consolelog.txt

# check JUnit test eclipse workspace error log
oddl; cd testing/*/testing/eclipse/workspace/.metadata/; less .log

UI Testing

  • First, your build server must be running an X server. See Verify X Server.
  • Second, to enable UI testing during the automated tests that run during your build, you must do two things:
  • Switch your test.xml to use 'ui-test' instead of 'core-test'. Repeat for all test plugins which have UI tests. Example
  • Enable your tests to run connected to an X server. Example
  • To avoid UI thread collisions when two builds are runnning concurrently, choose a port number that is not already in use. Please add your port number here:
  • :0 - reserved
  • :31 - Ecore Tools
  • :42 - GEF
  • :15 - GMF
  • :17 - UML2Tools
  • :12 - Xtext
  • If you ever get a stuck thread (eg., you forget to kill the Xvfb process) you can manually kill it like this:
xport=31; \
sudo -u apache kill -9 $(cat /tmp/.X${xport}-lock); \
sudo -u apache rm -fr /tmp/.X${xport}-lock /tmp/.X11-unix/X${xport}

Suppressing Compiler Warnings

After 3.2M6, PDE will now report compilation warnings in its JUnit test results page.

You can either fix your code to remove these warnings, or suppress the warnings themselves. See /org.eclipse.emft/releng/jet/buildAll.xml, for an example of how to suppress these warnings.

<echo message="Set compilerArgs = '-enableJavadoc -encoding ISO-8859-1 -warn:-serial -warn:-warningToken'"/> 
<property name="compilerArg" value="-enableJavadoc -encoding ISO-8859-1 -warn:-serial -warn:-warningToken" />

For a complete list of supported warning flags, go here: http://help.eclipse.org/stable/index.jsp?topic=/org.eclipse.jdt.doc.isv/guide/jdt_api_compile.htm (see Warning Options).

You can also bring up that same help page in Eclipse's built-in help (JDT Plug-in Developer Guide > Programmer's Guide > JDT Core > Compiling Java code) for the 3.2 version, which adds a couple other options to the list.

Heterogeneous Compiler Source/Target Levels

If your project has plug-ins that have different requirements for the compiler source and target compliance level, the PDE's build.properties file can be used to specify these on a plug-in by plug-in basis. For a plug-in that supports J2SE 1.4 and above, just add:

javacSource = 1.4
javacTarget = 1.4

in that plug-in's build.properties. For a plug-in that uses J2SE 5.0 language capabilities, just add:

javacSource = 1.5
javacTarget = 1.5

and similarly for 6.0, 7.0, ... For an example, see the validation.ocl plug-in, which differs from the other validation plug-ins in requiring J2SE 5.0.

You may already have an EMFT releng system that forces 1.4 source and target in the buildAll.xml file. Simply remove that and the javacSource=1.4 entries from the build.properties files in each builder/* folder. For example, see in the Query component's releng:

Signing and Packing Jars

All-In-One Bundles

See All-In-Ones. Note that a better approach is probably to use the EPP system or to include yourself in the latest coordinated release, eg., Galileo.

Running Builds

You can run your build from the commandline with start.sh, but it's much easier to use the web UI:

Sample EMFT Build Page

Build Artifacts

When start.sh runs, it produces two configuration files: a CVS map file and a config file. The map file is either extracted from CVS or is generated by genBuildDetails.sh, which calls createMapAndTestManifest.xml.

Here is a sample mapfile and config file:

These two files control how the build behaves as far as defining what goes in (upstream zip dependencies, CVS sources) as well as other options, environment variables and properties. The config file is also where ${fooFile} and ${fooURL} ant variables are defined.

Controling the appearance of your build page

  • Some items on your build page can be changed:
  1. Edit your /cvsroot/org.eclipse/www/modeling/<project>/<component>/build/_common.php
  • Then, commit your changes and refresh the file on the build server:
  1. Commit to CVS
  2. SSH to your build server
  3. cd into /var/www/html/modeling/<project>/<component>/build/
  4. cvs up

Changing tags

  • Temporary change (for testing/debugging)
  • Switch to debug mode (see link in top-right corner of your build page). This will allow you to override any of the four tags/branches used when checking out sources:
  1. org.eclipse.releng.basebuilder branch (this tag changes over time)
  2. org.eclipse.modeling.common.releng branch (common releng code is normally checked out of HEAD)
  3. org.eclipse.*.releng branch (your component's releng module)
  4. org.eclipse.* branch (your component's source, if not from HEAD or some branch)
  • Change the default basebuilder tag
  • See above: change the value of this entry:
"BaseBuilderBranch" => "M7_34"

Scheduling Automated Builds

See Scheduled Builds.

Build Problem FAQ

In no particular order, here are some lessons learned from setting up builds:

Built features & plugins have "HEAD" in their version qualifier

Ecoretools-built-from-HEAD.png

There are two ways to control the naming of your features & plugins.

The simplest is to set this code in your buildAll.xml, before you load your label.properties file:

<property name="forceContextQualifier" value="v${timestamp}" />
<echo file="${buildDirectory}/label.properties" append="true">
forceContextQualifier=${forceContextQualifier}
</echo>
<echo message="forceContextQualifier=${forceContextQualifier}" />

<property file="${buildDirectory}/label.properties" />

This will make all your plugins and features have the same qualifier, eg., 0.8.0.v200804211234 (and any optional suffixes).

If, however, you want more fine-grained control, or to NOT always build from HEAD but from tags you specifically set, you can use the Eclipse Releng Tool to tag & release your features & plugins individually (more info). By doing so, your map file(s) will contain the specific versions of features & plugins which are to be contributed to your build. Please use the convention "vYYYYMMDD" or "vYYYYMMDDhhmm" when tagging in order to ensure that your updated features & plugins will be treated as newer by Update Manager.

Build fails, stalls, or tests never complete

Check the available disk space:

$ df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/sda1              40G   38G     0 100% /

If you're out (or nearly out) of space, go purge your old N builds, or any 2-3month old I, m, or S builds.

$ cd /home/www-data/build/modeling/emft/net4j/downloads/drops/0.8.0
$ sudo -u apache rm -fr N200710091056

Note also that "unclean" builds will take up considerably more disk space than regular builds. To "clean" a build:

$ cd /home/www-data/build/modeling/emft/net4j/downloads/drops/0.8.0/N200710091056
$ sudo -u apache rm -fr org.eclipse* eclipse/ testing/ noclean

If you just want to kill the build processes then kill them by process number:

$ ps ax --forest
$ sudo -u apache kill -9 12345 23456 ...

java.net.MalformedURLException: no protocol: ${fooURL}

Oops! You forgot to select the foo zip on the build page, so genBuildDetails.sh never defined this variable for you. Or, you forgot to remove a reference to a zip you don't actually need.

SomeBundleOrClass cannot be resolved -- compilation fails

Check your feature.xml files. PDE will build features in the order they're listed. See also bug 140745.

.doc plugin not found

org.eclipse.emft.ocl.releng/ builder/sdk/customTargets.xml -> eclipse/assemble.org.eclipse.emf.ocl.sdk.xml -> eclipse/tmp/eclipse/plugins/ org.eclipse.emf.ocl.doc_1.0.0.200602231606 not found

This could be a number of problems, but the most likely is that org.eclipse.emft/ocl/doc/org.eclipse.emf.ocl.doc/build.xml needs to have the correct value for pluginVersion set or is missing this property entirely.

<property name="pluginVersion" value="1.0.0"/>

If that doesn't solve the problem, run a debug build with the -noclean flag checked to see what's in the eclipse/tmp/eclipse/plugins/ folder. For the case of the above build, the folder created was called org.eclipse.emf.ocl.doc_${pluginVersion}.200602231617 instead of org.eclipse.emf.ocl.doc_1.0.0.200602231617, since the property was not defined.

java.io.FileNotFoundException: eclipse/fetch_org.eclipse.emft.mwe.sdk.xml (No such file or directory)

Either the feature doesn't exist (and must be added), or the feature is misreferenced. Make sure that you do not have any scripts referring to, say, plugins or features called org.eclipse.emft.mwe.sdk, but rather org.eclipse.emf.mwe.sdk.

Failure to download and unzip one of the SDKs that your project depends on

You probably have a typo in the URL that you entered into the "New URLs" field. Try the following to get the correct URL every time:

  1. Surf to your dependency's downloads page on eclipse.org.
  2. Navigate to the build that you need.
  3. Click the download link for the all-encompassing SDK ZIP.
  4. When the "blah now downloading, if it doesn't start immediately, click here" message appears, right-click on the "click here" link and select "Copy Link Location" (or the equivalent action in your browser or choice).
  5. You now have in your cut buffer the exact link to the file that you need.

Depending on your configuration, you may have an extra navigation to a mirror site in the above sequence.

Build is ok, everything compiles, but plugins are missing from the SDK

Build is ok, everything compiles, but SDK includes BOTH unpacked source files and packed src.zip files

Verify that you have included your branding plugin (eg., org.eclipse.net4j) in your branding feature (eg., org.eclipse.net4j-feature/feature.xml), even if it contains NO source and that you've set that plugin to be unpack="false":

<plugin
  id="org.eclipse.net4j"
  download-size="0"
  install-size="0"
  version="0.0.0"
  unpack="false"/>

Plugin jars contain nested jars instead of class files

See Bundle-ClassPath With Dot. See also bug 185001.

External jar files (like log4j) are not included in the plugin when building and zipping the plugins

Ensure that the Bundle-ClassPath in the MANIFEST.MF contains the dot (.) for example:

Bundle-ClassPath: .,commons-logging.jar,log4j-1.2.8.jar

publish.xml fails to generate build artefacts

This has been deprecated in the latest org.eclipse.releng.basebuilder. For the solution, see details in bug 165698.

Features do not include extended suffixes

Extended suffixes allow you to have a feature whose contents do not change, but whose version increments every time the included artefacts (plugins, subfeatures) do change. So, for example, if your SDK feature's contents have not changed since 1.0.4 but some or all of the included plugins are now at 1.1.0, you need not release a 1.1.0 version of your feature simply to allow your users to be able to install the updated plugins from the feature. The suffix will make the OSGi name of the feature "newer".

To enable this functionality, so your features to look like

org.eclipse.gmf.runtime.thirdparty_1.0.0.v20080107-0000-7J8P4EEt6Yajc-ifjYcd

instead of

org.eclipse.gmf.runtime.thirdparty_1.1.0.v20080328-1605

then you need to enable feature version suffix generation. In your .releng/builder/*/build.properties, add:

generateFeatureVersionSuffix=true

Sources not found when installed by p2 (Eclipse 3.4M6+)

If you've recently moved up to the latest Eclipse 3.4M6 or later, and have tried to install some SDK only to discover that the sources aren't found, you need to implement this change in your source plugins' MANIFEST.MF files:

Eclipse-SourceBundle: org.eclipse.core.runtime;version="3.4.0.v20080324-1725";roots:="."

See also:

Need to update your build to EMF 2.3 and J2SDK 5.0

See EMF 2.3 Adoption.

java.lang.NoClassDefFoundError: org/eclipse/core/launcher/Main

You need to upgrade to the Equinox Launcher. See Automated PDE JUnit Testing With Eclipse for details on how to fix this problem.

Out Of Memory Errors

This can be related to the memory available to the build process itself. The build is started via your component's build page, which collects properties and settings and passes them to the start.sh script.

To increase the available memory set the -Xmx parameter in the start.sh script (see Invoking Eclipse build...). Note that this script is shared by everyone on the server, so if at some point it's discovered that we need to change the global settings here, this is the place to change it by submitting a patch. On the other hand, if your build has memory requirements that are very different from others, submit a request to have memory and permgen settings for all builds a per-build configurable parameter.

Another cause can be the memory usage of component-specific build steps. If your component launches separate processes with their own jvm, you need to performance tune those steps. Here's an example.

Adding a new dependency

Sometimes we need to create a feature which depends on third-party plugins the rest of our projects don't need. For example, we might need an "integration" feature for our project to behave correctly with a given plugin, but we don't want users to be forced to download this dependency. In such cases we create new features and build targets as shown above in customizing zip bundles.

To add the dependency, simply change the target "postSetup" of your customTargets.xml. For exemple to add a dependency on EMF Compare, add

<ant target="getDependency" antfile="${getDeps.xml}">
 <property name="url" value="${compareURL}"/>
 <property name="file" value="${compareFile}"/>
 <property name="isUnpackedFile" value="${buildDirectory}/plugins/org.eclipse.emf.compare/plugin.xml" />
</ant>

so that it will fetch the build infrastructure will know you wish to retrieve EMF Compare to build this particular target. Note however that this will not work for plugins distributed as update sites. For such dependencies, you will need to call "getUpdateSiteDependency" instead of "getDependency". For exemple, to add a dependency towards subversive, you can use :

<ant target="getUpdateSiteDependency" antfile="${buildDirectory}/../org.eclipse.modeling.common.releng/scripts/getDependencies.xml">
 <property name="url" value="${subversiveURL}" />
 <property name="file" value="${subversiveFile}" />
</ant>

Testing Problem FAQ

In no particular order, here are some lessons learned from setting up builds:

Cannot run tests on 64-bit OS

If you get any of the following errors, see Modeling Project Releng/Building/Test on 64-Bit.

java.lang.UnsatisfiedLinkError: no swt-pi-gtk-3449 or swt-pi-gtk in swt.library.path, java.library.path 
or the jar file at org.eclipse.swt.internal.Library.loadLibrary(Library.java:233)
[javac] 	import org.eclipse.swt.graphics.Color;
[javac] 	       ^^^^^^^^^^^^^^^
[javac] The import org.eclipse.swt cannot be resolved
org.osgi.framework.BundleException: The activator org.eclipse.ui.internal.WorkbenchPlugin for bundle org.eclipse.ui.workbench is invalid
Caused by: java.lang.NoClassDefFoundError: org/eclipse/swt/SWTError
org.eclipse.core.runtime.CoreException: Plug-in org.eclipse.test was unable to load class org.eclipse.test.UITestApplication.
Caused by: org.eclipse.core.runtime.internal.adaptor.EclipseLazyStarter$TerminatingClassNotFoundException: 
An error occurred while automatically activating bundle org.eclipse.ui.workbench (154).
!MESSAGE Platform filter did not match: (& (osgi.os=linux) (osgi.arch=x86_64))

Tests require Assertions, but Assertions are not enabled

You can set the -ea or -enableassertions flag in two places:

1. relengbuildgtk.sh, the script that start up your test suites

echo "[runtests] [`date +%H\:%M\:%S`] Launching Eclipse (installmode = $installmode with -enableassertions turned on) ..."
execCmd "$JAVA_HOME/bin/java $Xflags -enableassertions -cp $cpAndMain -ws $ws -os $os -arch $arch \
 -application org.eclipse.ant.core.antRunner -data $workspaceDir -file test.xml $antTestTarget \
 $Dflags -Dws=$ws -Dos=$os -Darch=$arch -D$installmode=true $J2SE15flags \
 $properties -logger org.apache.tools.ant.DefaultLogger" $consolelog;
echo "[runtests] [`date +%H\:%M\:%S`] Eclipse test run completed. "

However, as recently discovered, this won't actually turn Assertions on, because each test plugin forks a separate thread for its tests, and does not forward this flag to that process.

2. test.xml, the script that each test plugin uses to define which tests to run

<ant target="core-test" antfile="${library-file}" dir="${eclipse-home}">
  <property name="extraVMargs" value=" -ea"/>
  <property name="data-dir" value="${emf-folder}" />
  <property name="plugin-name" value="${plugin-name}" />
  <property name="classname" value="${classname}" />
</ant>

or

<ant target="ui-test" antfile="${library-file}" dir="${eclipse-home}">
  <property name="data-dir" value="${gef-folder}" />
  <property name="plugin-name" value="${plugin-name}" />
  <property name="vmargs" value="${Dflags} -ea" />
  <property name="classname" value="${classname}" />
</ant>

Next, to verify that Assertions are in fact enabled, stick this into one of your JUnits, and run it as part of a build.

try
{
  assert false;
  fail("Assertions must be enabled via JVM flag -ea or -enableassertions");
}
catch (AssertionError exception)
{
  // Ignore
}

or

boolean assertsEnabled = false; 
assert assertsEnabled = true;
assertTrue("Assertions must be enabled via JVM flag -ea or -enableassertions", assertsEnabled);

Note that to run tests with Assertions locally in Eclipse you have to add the VM argument "-ea" to the Run or Debug Configuration on the Arguments tab.

Cannot find a test suite's console log (.metadata/.log)

To capture the console logs for each independent test suite (.metadata/.log from the test's workspace), you need to edit the cleanup target of each test plugin's test.xml. Make sure that ${classname} is globally defined.

<target name="cleanup">
  	<mkdir dir="${results}/consolelogs"/>
	<copy failonerror="false" 
             file="${eclipse-home}/results/${classname}.txt"
             tofile="${results}/consolelogs/${classname}_${platform}.metadata.log.txt" />
</target>

Now, after your tests run, you'll get one more log file (for each test.xml you change) in your build folder's testresults/consolelogs/ folder. For easy access, these new logs will appear on that build's Test Results page, linked from your downloads page.

eclipse/test.assembly/eclipse/ plugins/${org.eclipse.test} not found

Add the "org.eclipse.test" and "org.eclipse.ant.optional.junit" plugins to each test feature. The task creates one property for each test plugin (the property name is the plugin name minus the version). Only plugins referenced by features are downloaded, and, if a plugin has to be downloaded, the map file has to describe how to do it. Thus this information must appear in two places: tests/customTargets.xml and *.tests-feature/feature.xml. Since "org.eclipse.test" is not listed on the tests feature, it is not being downloaded - regardless of it being listed in the map file.

If you have added this to your mapfile and features, and you're still having problems, verify your mapfile has the right tag for org.eclipse.test.

If you have checked all these conditions and still get an error, make sure your test feature specifies version="0.0.0" for the org.eclipse.test plugin so that PDE can calculate the version for you. This problem manifests with releng.basebuilder versions after M4_33, as discussed in bugs 190834 and 192231.

Additionally, good hygiene suggests that all your features should have the correct builder/nature in their .project files. This will ensure that when you're manipulating your features in Eclipse, PDE will report problems (eg., typos) as they happen rather than during a build.

<buildSpec>
  <buildCommand>
    <name>org.eclipse.pde.FeatureBuilder</name>
    <arguments/>
  </buildCommand>
</buildSpec>
<natures>
  <nature>org.eclipse.pde.FeatureNature</nature>
</natures>

eclipse/test.assembly/eclipse/ plugins/org.eclipse.test_3.1.0 not found

Ensure that you're unpacking your junit-tests zip properly. If you've just switched to/from the "incubation" filename convention, ensure that the value for ${archiveName} is set correctly. See this example.

<property name="archiveName" value="emft-${subprojectName}-junit-tests-incubation-${buildAlias}.zip"/>
<unzip dest="${workingDirectory}" overwrite="true">
  <fileset dir="${buildDirectory}/${buildLabel}"><include name="**/emft*junit*.zip"/></fileset>
</unzip>

Could not create the Java virtual machine

[exec]   -cp  org.eclipse.equinox.launcher.Main
                    ...
[exec] Unrecognized option: -ws
[exec] Could not create the Java virtual machine

Check relengbuildgtk.sh, and make sure the $cp or $cpAndMain variable is being set correctly. Also, make sure that if you're building with Eclipse 3.2 you use org.eclipse.core.launcher.Main instead of Eclipse 3.3's org.eclipse.equinox.launcher.Main. See also Running Eclipse and PDE JUnit Testing.

java.io.FileNotFoundException: testing/target/eclipse/ plugins/org.eclipse.emf.ocl.tests_1.0.0/ (Plugin is a jar, not a folder)

If your test plugin is compiled as a jar, not a folder, you need to fix your feature.xml. Remove the attribute unpack="false" from the org.eclipse.emf.*.tests plugin:
<plugin id="org.eclipse.emf.ocl.tests" download-size="0" install-size="0" unpack="false" version="1.0.0"/>


Must define 'org.foo.ui.test.suite=org.foo.ui.test.AllTests' in your .releng/testing.properties

If you have created testing.properties but still get the error, check that the testPluginsToRun list doesn't contain whitespaces. See bug 280747

java.io.FileNotFoundException: testing/target/eclipse/ plugins/org.eclipse.emf.ocl.tests_1.0.0/ test.xml (No such file or directory)

Add a "test.xml" script to each test plugin, in tests/org.eclipse.emf.*/test.xml.

If this file already exists, verify in releng/ [subproject]/ builder/ tests/ scripts/ test.xml that target runtests knows whether your tests plugin is jarred or not. Comment/uncomment out test.xml script accordingly.

Don't forget to verify as well you added test.xml in your build.properties.

java.lang.Exception: Could not find plugin "org.eclipse.emf.mwe.tests"

If you can build without running tests (uncheck the JUnit Tests checkbox on the build page), but when you try to run the tests you get a 'Could not find plugin' error for your test plugin, you may be missing dependencies in your test environment. There are two places to check, and to add missing runtime dependencies:

JUnits tests not appearing on testResults.php page

Add an entry for the missing tests into org.eclipse.emft/releng/[subproject]/ templateFiles/testManifest.xml.template and org.eclipse.emft/releng/[subproject]/ testManifest.xml, eg:

<logFile 
  name="org.eclipse.emf.query.ocl.tests_linux.gtk.xml">
<effectedFile id="SDK"></effectedFile>
<effectedFile id="projRUN"></effectedFile>
</logFile>

JUnits do not run with p2-enabled Eclipse

After 03/05, Eclipse ships with p2. This changes the way that features and plugins can be naively dropped into an Eclipse install. Instead of unzipping into eclipse/features/ and eclipse/plugins/, you now have to unzip into eclipse/dropins/eclipse/features/ and eclipse/dropins/eclipse/plugins/.


To convert your releng.basebuilder-based automated JUnit tests to use this new path, see this example.

  • o.e.foo.test.*/test.xml (one test.xml for each of your test plugins)
  • o.e.foo.releng/builder/tests/scripts/test.xml
  • o.e.foo.releng/builder/tests/customTargets.xml
  • org.eclipse.foo.releng/maps/foo.map (to update to the latest o.e.test tag)


NOTE: As of the 03/27 Eclipse Platform build, this conversion is no longer mandatory though still recommended, as p2 has been enhanced to search for dropins in the root eclipse/ folder as well as the dropins/ folder.

Back to the top