POM-less Tycho builds for structured environments

2 minute read

With Tycho 0.24 POM-less Tycho builds where introduced. That approach uses convention-over-configuration to reduce the number of redundant information for setting up a Tycho build. In short, that means you don’t need to create and maintain pom.xml files for bundle, feature and test projects anymore, as the whole information can be extracted out of the already existing information in MANIFEST.MF or feature.xml.

Lars Vogel shows in his Tycho Tutorial a recommended folder structure, that is also widely used in Eclipse projects.

The meaning of that folder structure is:

  • bundles contains all plug-in projects
  • features contains all feature projects
  • products contains all product projects
  • releng contains projects related to the release engineering, like
    • the project containing the parent POM
    • the aggregator project that contains the aggregator POM which defines the modules of a build and is also the starting point of a Tycho build
    • the target definition project that contains the target definition for the Tycho build
  • tests contains all test plug-in/fragment projects

This structure helps in organizing the project. But there is one convention for POM-less Tycho builds that is not working out-of-the-box with the given folder structure: “The parent pom for features and plugins must reside in the parent directory”. Knowing about the Maven mechanics, this convention can also be satisfied easily by introducing some POM files that simply connect to the real parent POM. I call them POM-less parent POM files. These POM-less parents need to be put into the base directories bundles, features and tests. And they do nothing else than specifying the real parent POM of the project (which is also located in a sub-directory of releng.

The following snippet shows a POM-less parent example for the bundles folder:

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
    http://maven.apache.org/maven-v4\_0\_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <artifactId>org.fipro.example.bundles</artifactId>

    <packaging>pom</packaging>

    <parent>
        <groupId>org.fipro.example</groupId>
        <artifactId>org.fipro.example.parent</artifactId>
        <version>1.0.0-SNAPSHOT</version>
        <relativePath>../releng/org.fipro.example.parent</relativePath>
    </parent>
</project>

For the features and tests folder you simply need to modify the artifactId accordingly.

Note that you don’t need to reference the POM-less parent POM files in the modules section of the aggregator POM.

Following the best practices regarding the folder structures of a project and the conventions for POM-less Tycho builds, you will have at least 7 pom.xml files in your project.

  • parent POM the main build configuration
  • aggregator POM the collection of modules to build
  • target-definition POM the eclipse target definition build
  • product POM the eclipse product build
  • POM-less parent POM for bundles the connection to the real parent POM for POM-less plug-in builds
  • POM-less parent POM for features the connection to the real parent POM for POM-less feature builds
  • POM-less parent POM for tests the connection to the real parent POM for POM-less test plug-in builds

Of course there will be more if you provide a multi-product environment or if you need to customize the build of a plug-in for example.

With the necessary Maven extension descriptor for enabling the POM-less Tycho build (see POM-less Tycho builds), the folder structure will look similar to the following screenshot:

I hope this blog post will help people setting up Tycho builds for their products more easily using POM-less Tycho.

Updated: