Maven BOMs without dependencyManagement

Hey all devs,
I been playing lately with development of side extension and found an unexpected thing - openhab bill of material poms do not provide a dependencyManagement section. This means that by importing any openhab BOM you always get all dependencies declared there, even if you need only.

The main reason why I bring it here is because standard use (at least which I have seen in other projects) of BOMs is to manage dependencies and their versions and not only “import” dependencies. People who use then such a BOM can refer dependencies without explicit versions as they are inherited from base project.

For example:
org.openhab.core.bom.compile:


  <dependencies>
    <dependency>
      <groupId>org.osgi</groupId>
      <artifactId>osgi.core</artifactId>
      <version>6.0.0</version>
    </dependency>
    ... ... ...
  </dependencies>

This means that such dependency is propagated to every project which imports org.openhab.core.bom.compile. There are much more dependencies in same pom which gets into every binding/transport/io module.

In other project BOMs dependencies such this are listed in different way:

  <dependencyManagement>
    <dependencies>
      <dependency>
        <groupId>org.osgi</groupId>
        <artifactId>osgi.core</artifactId>
        <version>6.0.0</version>
      </dependency>
      ... ... ...
    </dependencies>
  </dependencyManagement>

This means that project after importing a BOM still needs to declare explicit dependency on org.osgi:org.osgi and other things as needed.

I am aware that current use of BOMs drastically simplifies binding development as their developers don’t have to worry about all modules, however shouldn’t we make it a bit smarter and at least let proper use of Maven dependencies? Could we (as OH project) provide a different variant of BOM, one which promotes fine grained control over classpath?

Cheers,
Łukasz

I think you found your answer. But also consider that when bindings are in openHAB the maintenance falls back to the hand-full core maintainers who need to step up when changes are made that affect all bindings. And I don’t think they are willing to maintain the dependencies of more than 200 bindings, just because it’s somehow better.

Saying it should be proper use is in my opinion subjective. The tool should work for us, we should not work for the tool. And I don’t see a way that would not require more management of dependencies, but still would be as easy to use as it currently is. So I’m not really understanding what problem you want to solve here?

I referred to “proper” as this is how the same functionality is used elsewhere. It is also being described in official maven documentation under “dependency management” section: https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html#Importing_Dependencies.

Bringing dependency management into BOM can allow development of smaller projects beside main repository with just few dependencies and without bringing 10’s of JARs which are not necessary in context of specific plugin.
All I am asking about is to repeat a dependency section from current bom in dependency management. Then you don’t need to declare version of dependencies in earlier section and others can utilize BOMs in regular way.

Currently, even if I stick with OH 2.5.0.M5 which brings BOMs I have to copy-paste all their contents to my maven parents as there is no way to import dependency management alone. Given the size of openhab core alone it is quite many JARs to manage for no reason. I understand rule of thumb for getting OH addons in place and I am not willing to change that.