Incremental Builds in Sling IDE tooling for Eclipse

Overview

The Sling IDE Tooling relies on the m2e incremental build support for the generation of the bundle's manifest, the component descriptions as well as the metatype resources (the latter two being generated through OSGi 6 component annotations and metatype annotations or through Apache Felix SCR annotations). That means whenever at least one java class is touched and the auto-build in Eclipse is enabled the annotations on that class should be reevaluated. This may lead to a modification of the bundle's manifest and/or generation/modification of service description XMLs and/or Metatype resource files. Depending on which maven plugins you use you must adjust their configuration accordingly to properly support incremental builds.

Manifest Generation

maven-bundle-plugin

The maven-bundle-plugin is based on the bnd library. It uses bnd to generate the bundle's manifest.

maven-bundle-plugin prior to version 3.2.0

This version needs m2eclipse-tycho (an Eclipse plugin) to generate the manifest and service descriptions during the incremental build. This plugin can be installed through the Maven Discovery feature of m2e.

maven-bundle-plugin since version 3.2.0

Natively supports incremental builds for the manifest goal (FELIX-4009) which needs to be explicitly configured as outlined in the maven-bundle-plugin FAQ. Older versions of m2e-tycho are incompatible with that version, because it leads to errors like Duplicate bundle executions found. Please remove any explicitly defined bundle executions in your pom.xml. and Duplicate manifest executions found. Please remove any explicitly defined manifest executions in your pom.xml. It is therefore recommended to install m2e-tycho version 0.9.0.201811261502 or newer. The update sites for m2e-tycho can be found at.

bnd-maven-plugin

The bnd-maven-plugin is developed from the bnd team and is based on bnd as well. It is versioned in parallel with bnd and bndtools. It natively supports incremental builds since version 3.1.0 (issue 1180).

Service Description and Metatype Resources

OSGi component and metatype annotations (for OSGi 6) are natively supported through bnd (and therefore automatically generated through both maven-bundle-plugin and bnd-maven-plugin). You don't need to configure anything explicitly since version 3.0.0 of bnd (issue 1041).

The maven-bundle-plugin can be optionally coupled with the maven-scr-plugin. Both maven-bundle-plugin as well as bnd-maven-plugin can be optionally coupled with the scr-bnd-plugin. Both approaches can be used to generate components descriptions and metatype resources out of the Felix SCR annotations. The recommended way for new projects though is to rely on OSGi 6 annotations. However if you need to rely on Felix SCR annotations though it is recommended to rather use the scr-bnd-plugin over the maven-scr-plugin, as the former is nicely integrated into bnd and therefore means less overhead during the build.

- ( Incremental Builds in Sling IDE tooling for Eclipse )