I’m wondering what’s the preferred way to install addons that have dependencies on other features. For example, when I install homekit via:
It automatically installs the
openhab.tp-netty feature dependency.
However, if I uninstall the feature and install a forked homekit build via:
… it does not install the
openhab.tp-netty feature. I am greeted with the following error, instead, when trying to start the bundle:
openhab> bundle:start 283
Error executing command: Error executing command on bundles:
Error starting bundle 283: Could not resolve module: org.openhab.io.homekit 
Unresolved requirement: Import-Package: io.netty.bootstrap; version="[4.1.0,5.0.0)"
If I manually install the feature,
openhab.tp-netty, ensure the bundles are all active, and then start my homekit bundle, it will launch happily.
So, what is the best way to install forked bundles like this?
a) The way I described, above, is ideal.
b) Install the feature via
feature:install openhab-misc-homekit, then update the bundle via
bundle:update org.openhab.io.homekit https://github.com/ccutrer/openhab-addons/releases/download/homekit-20221220-02/org.openhab.io.homekit-3.4.0-SNAPSHOT.jar
c) something else?
You need a
kar file instead of a
jar. You can built a kar file with maven
karaf:kar. But make sure the built is the same openHAB version as the system you want to use the kar file.
Thank you! That appears to help, but then introduces another problem in which the dependencies on the openhab version are rather strict (build for openhab-addons binding against 3.4.1-snapshot will refuse to load in an openhab 3.4.0 instance).
Is there an easy way to change the base openhab dependency versions for openhab-addons? I thought to rebase on the 3.4.0 tag, but, sadly no such tag exists (although prior releases of openhab have a tag in openhab-addons have one). Further, trying to edit the base pom.xml and changing 3.4.1-snapshot to 3.4.0 results in lots of build errors, so I abandoned the attempt.
Apologies if this is well documented and I missed it.
I have the same issue because some versions of openHAB use Netty 4.x and others use 4.x+2
I find in this example it is easier to just install the Tellstick or IpCamera binding as they also use the Netty libs. Hopefully your binding does not need a different Netty lib that those do not use so this works for you. You can also drop the raw netty JAR files into the addons folder and that works as well, but the KAR is a better way.
You can run maven with
-Dohc.version=3.4.0. This will set the version in the feature file to that version.
I’m not sure it completely works when there are dependecies. I had mixed success with also setting the parent pom version to a different version.
Thank you @hilbrand!
-Dohc.version=3.4.0 does the trick!