Skip to content

thingfour/openhab-bom

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

65 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Thing4 - openHAB BOM

This repository brings bill of materials pom for openHAB project for externalized use.

The bill of materials pom is special kind of Maven POM file which defines permitted dependency versions. Regular BOM files shipped by openHAB project itself are just dependency aggregators. They do not ship dependencyManagement section, just list of dependencies which are pulled all together to the project classpath. Such approach leads to situation where classpath might be polluted by more elements than actually needed.

The BOM approach presented in this repository is different. By defining dependencyManagement section Thing4 BOMs ship platform definition. Specific dependencies (i.e. on openHAB core artifacts) have to be explicitly declared, but without version. This allows a fine-grained control over dependencies and dependency paths.

Part of history for this repository remains in openhab/openhab-core#2925.

Use of BOMs

The openHAB project ships several 'BOM' files. In a way each is scoped and have its own role. The Thing4 BOM files use same artifact id as openHAB core, but stick to org.thing4.openhab.bom.generated group id.

Below table present available BOMs and their responsibility:

BOM artifact Role
org.openhab.core.bom.compile compile time dependencies.
org.openhab.core.bom.compile-model compile dependencies for Xtext stuff, including Xtext code generators.
org.openhab.core.bom.openhab-core dependency declarations for all openHAB core artifacts.
org.openhab.core.bom.runtime runtime dependencies, used primarily by BND tools and IDE plugins to assemble runtime.
org.openhab.core.bom.test dependencies used mostly for OSGi integration testing. All dependencies re-scoped to test.

In order to consume these BOMs you need following section in your Maven POM file:

    <dependencyManagement>
      <dependencies>
        <dependency>
          <groupId>org.thing4.openhab.bom.generated</groupId>
          <artifactId>org.openhab.core.bom.openhab-core</artifactId>
          <version><!-- place openHAB version here --></version>
          <type>pom</type>
          <scope>import</scope>
        </dependency>
      </dependencies>
    </dependencyManagement>

Shipping updates

The BOM files are generated by XSLT transformation. There is little to no manual effort to keep them updated. In case if you encounter troubles with consuming of supplied BOM files please report a bug.

Major part of work is done by bom.xsl which merges dependencies and dependencyManagement sections. It does also few more things. Transformation is run automatically within each and every maven build. Transformation configuration is defined in pom.xml.

When new version of BOM is needed procedure remains as following:

#!/bin/sh

version='4.2.0'
git checkout -b $version
mvn versions:set -DnewVersion="${version}-SNAPSHOT"
mvn versions:update-property -Dproperty=openhab-core.version -DnewVersion="${version}"
mvn clean install
git commit -a -m "Update BOM for openHAB ${version}".
mvn release:prepare && mvn release:perform

About

Generated Bill Of Materials (BOM) files for openHAB project.

Resources

Stars

Watchers

Forks