Dependency Management
The central Maven Bill of Materials (BOM) that sets dependency versions for all OpenEPCIS modules.
Quick links
The source code of the BOM is on GitHub:
• EPCIS parent POM for dependency management application code: https://github.com/openepcis/openepcis-bom
Introduction
OpenEPCIS-BOM is the central Maven Bill of Materials (BOM) for all OpenEPCIS projects. It gives every OpenEPCIS module the same versioned set of dependencies, so versions are managed in one place. This page explains what the BOM is for and how to use it in a module.
What is a Maven BOM?
A Maven Bill of Materials (BOM) is a special kind of POM (Project Object Model) that controls the versions of the dependencies a project and its sub-modules use. It holds no build logic and no source code; its content is a list of dependencies with their versions.
Child modules declare their dependencies without a version and inherit the version from the BOM. Every version is therefore set in one place, which makes updates across many modules a single change, keeps all modules on the same versions and reduces the risk of unexpected dependency conflicts in the build.
OpenEPCIS-BOM
OpenEPCIS is built from many modules, each with its own dependencies. OpenEPCIS-BOM keeps their versions uniform: its POM file lists every dependency the OpenEPCIS modules need, together with its version, and each module imports the BOM to inherit those versions. When a module introduces a new dependency, the dependency and its version are added to OpenEPCIS-BOM.
Using the OpenEPCIS-BOM
An OpenEPCIS module uses the BOM by importing it in its POM file, in two steps.
- Import the BOM. Add the following
<parent>section to your module's POM file and replace${openepcis.version}with the version of OpenEPCIS-BOM you want. This variable is typically defined in the parent pom.
<parent>
<groupId>io.openepcis</groupId>
<artifactId>openepcis-bom</artifactId>
<version>${openepcis.version}</version>
</parent>
- Declare dependencies. In the
<dependencies>section of your module's POM file, declare the dependencies you need without a version. The versions are inherited from OpenEPCIS-BOM.
<dependencies>
<!-- Simple Logging Facade for Java (SLF4J) API -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<!-- Java library for processing JSON data -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
</dependencies>
A complete module POM then looks like this:
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>io.openepcis</groupId>
<artifactId>openepcis-bom</artifactId>
<version>${openepcis.version}</version>
</parent>
<artifactId>openepcis-module-name</artifactId>
<name>openepcis-module-name</name>
<packaging>pom</packaging>
<dependencyManagement>
<dependencies>
<!-- Simple Logging Facade for Java (SLF4J) API -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</dependency>
<!-- Java library for processing JSON data -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
</dependencies>
</dependencyManagement>
</project>