With Tycho 0.24 POM-less Tycho builds were introduced. This Maven extension was a big step forward with regards to build configuration, as plugin, feature and plugin test projects don’t need a dedicated pom.xml file anymore. Therefore there are less pom.xml files that need to be updated with every version increase. Instead these pom.xml files are generated out of the metadata provided via the MANIFEST.MF file at build time.
Although the initial implementation was already a big improvement, it had some flaws:
- Only plugins, features and test plugins were supported
- target definition, update site and product builds still needed a dedicated pom.xml file
- test plugins/bundles needed the suffix .tests
- in structured environments “POM-less parents” or “connector POMs” were needed to be added manually
With Tycho 1.5 these flaws are finally fixed to further improve POM-less Tycho builds. To make use of those enhancements you need to follow these steps:
- Update the version of the tycho-pomless extension in .mvn/extension.xml to 1.5.1
- Update the tycho version in the parent pom.xml to 1.5.1 (ideally only in the
propertiessection to avoid changes in multiple locations)
- Make the parent pom.xml file resolvable by sub-modules.
This can be done the following ways:
- Place the parent pom.xml file in the root folder of the project structure (default)
- Configure the parent POM location globally via system property
tycho.pomless.parentwhich defaults to “..”.
- Override the global default by defining
tycho.pomless.parentin the build.properties of each individual project.
- In pom.xml files that are not generated by the tycho-pomless extension but managed manually (e.g. because of additional build plugins), configure the
relativePathfor the parent like shown in the following example:
<parent> <groupId>my.group.id</groupId> <artifactId>parent</artifactId> <version>1.0.0-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent>
- Delete the pom.xml in the target definition project (if nothing special is configured in there).
- Delete the pom.xml in the update site project (if nothing special is configured in there).
- Delete the pom.xml in the product project (if nothing special is configured in there).
If you have your project structure setup similar to the structured environments, the following steps need to be performed additionally in order to make POM-less Tycho work correctly:
- Change the
modulessection of the parent pom.xml to only point to the structure folders and not every single module:
<modules> <module>bundles</module> <module>tests</module> <module>features</module> <module>releng</module> </modules>
This will automatically generate the “connector POMs” that point to the parent pom.xml in the module folders. The name of these generated files is .polyglot.pom.tycho and they are removed once the build is finished. The generated “connector POM” files can even be referenced in the
<parent> <groupId>my.group.id</groupId> <artifactId>bundles</artifactId> <version>1.0.0-SNAPSHOT</version> <relativePath>../pom.tycho</relativePath> </parent>
The generation of the “connector POMs” has the advantage that new modules can be simply created and added to the build, without the need to update the parent pom.xml
modulessection. On the other hand it is not possible to skip single modules in the build by removing them from the
Additionally a file named pom.tycho is generated in each sub-folder, that lists the modules that are detected by the automatic module detection. Looking into the sources it seems like the idea of this file is to separate “connector POM” and module collection, to be able to manually list the modules that should be build. That file should be deleted if it is generated, but if it already exists it should stay untouched.
While testing in a Windows environment I noticed that somes the pom.tycho files stay as leftovers in the sub-folders even they were generated. This seems to be a bug and I reported it here. In case you see such leftovers that are not intended, make sure you delete them and do not commit them into the repository if you like the generation approach. Otherwise the automatic module detection is not executed and therefore new modules are not added automatically.
- Ensure that all modules are placed in a folder structure with the following folder names:
If you have additional folders or folders with different names, they are not taken up for automatic “connector POM” generation. To support additional folder names you can specify the system property
tycho.pomless.aggregator.nameswhere the value is a comma separated list of folder names.
For example, let’s assume instead of a releng folder the build related modules are placed in a folder named build. So instead of releng you would point to build in the
modulessection. Starting the build now leads to an error saying that there is no pom.xml found in the build folder. Starting the build the following way solves that issue:
mvn -Dtycho.pomless.aggregator.names=bundles,plugins,tests,features,sites,products,build clean verify
With these enhancements it is now possible to set up a Maven Tycho build for PDE based Eclipse RCP projects with a single pom.xml file.
The Maven versions 3.6.1 and 3.6.2 are known to fail with the pomless extension. There are issues reported here and here. Both are already fixed so by using Maven 3.6.3 the issues should not be seen anymore.
I would also like to mention that these enhancements where contributed by Christoph Läubrich who wasn’t a committer in the Tycho project at that time. Another good example for the power of open source! So thanks for the contributions to make the POM-less Tycho build more convenient for all of us.