PCM Development/Build Infrastructure/Setup Maven Build
This article describes how to set up a maven build for Palladio-related projects and how to integrate the build in the Palladio organization build process.
Generally, it is advised to look into our Collection of common pitfalls in defining builds before or during the process of defining your build.
Maven Tycho is an extension to Maven for building Eclipse plugins, features, products, and update sites. In order to use it, you only have to install Maven. The extension covers the usual build lifecycle including source generation, compilation, tests, and packaging. We created extensions for Tycho that handle JavaDoc generation, target platform definition, and commonly build descriptions.
The goal of using Maven Tycho is to create reproducible builds that do not depend on the execution environment but only on the build description. Therefore, we use explicit target platform definitions that contain fixed versions of dependencies. Additionally, we include a common base target platform for the execution environment in our parent POM. You can lookup the used target platform via the parent POM by looking for a property called
org.palladiosimulator.maven.tychotprefresh.tplocation.0. This will, most probably, refer to our target platform artifact. This target platform will be merged with project-specific target platforms during the build. The base target platform contains all bundles of the Eclipse Modeling Edition bundle in our targeted Eclipse version (e.g. Oxygen). The merging is done by a build lifecycle extension we created.
Besides merging, the extension can refresh versions of features referenced in a target platform and can filter location entries by keywords. You have to add the attribute
refresh="true" to the location tag in the target platform to refresh all versions of this entry. You can add a filter term to the location entry by adding the attribute
filter="term". Predefined terms are
nightly. The former is active during release builds, the latter is active during all other builds. You can add custom terms and add them to accordingly named properties to activate them. This process is covered in the readme of the extension.
Jenkins Pipeline Scripts
We use Jenkins as our build server that covers build and deployment of Palladio artifacts. Palladio builds always execute the same tasks for different input data. Therefore, we created reusable pipeline scripts that describe the build process in an abstract way. When defining a build job, we just fill in a few parameters to create a concrete build jobs.
The pipeline performs the following tasks
- checkout source code
- build the code by calling
mvn clean verify
- includes running tests
- includes running checkstyle
- includes creating javadoc
- deploy update site
- archiving build artefacts
- archiving quality metrics
- JUnit results
- test coverage
- mail notification about build result
The mandatory build parameters are:
gitUrl(https checkout url)
webserverDir(relative to the
eclipsebase folder on the webserver without leading and trailing slash)
updateSiteLocation(relativ path to the
repositoryfolder in the update site project's target folder without leading and trailing slash)
There are optional build flags that control the build process:
skipCodeQuality(default: false, disables collection of code quality metrics)
skipNotification(default: false, disables notifications of build results on the build mailing list)
The script can be modified on Github. Before every build job, the latest version from the master branch will be used.
Builds are triggered via Github triggers and time-based triggers.