openhab / org.openhab.binding.zigbee

openHAB binding for ZigBee
Eclipse Public License 2.0
73 stars 112 forks source link

Update feature name #610

Closed cdjackson closed 3 years ago

cdjackson commented 3 years ago

@wborn this ought to resolve https://github.com/openhab/openhab-distro/pull/1158

Signed-off-by: Chris Jackson chris@cd-jackson.com

wborn commented 3 years ago

No that won't work, I already tried that.

The issue is that the plugin will still add the generated feature using the artifactId name:

<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<features xmlns="http://karaf.apache.org/xmlns/features/v1.6.0" name="feature">
    <feature name="openhab-binding-zigbee" description="openHAB ZigBee Binding" version="3.0.0.SNAPSHOT">
        <feature>openhab-runtime-base</feature>
        <feature>openhab-transport-serial</feature>
    </feature>
    <feature name="org.openhab.addons.features.karaf.zigbee" description="openHAB Add-ons :: Features :: Karaf :: openHAB ZigBee Binding" version="3.0.0.SNAPSHOT">
        <details>This project contains the official add-ons of openHAB</details>
        <bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.zigbee/3.0.0-SNAPSHOT</bundle>
        <bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.zigbee.cc2531/3.0.0-SNAPSHOT</bundle>
        <bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.zigbee.console/3.0.0-SNAPSHOT</bundle>
        <bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.zigbee.console.ember/3.0.0-SNAPSHOT</bundle>
        <bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.zigbee.console.telegesis/3.0.0-SNAPSHOT</bundle>
        <bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.zigbee.ember/3.0.0-SNAPSHOT</bundle>
        <bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.zigbee.telegesis/3.0.0-SNAPSHOT</bundle>
        <bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.zigbee.xbee/3.0.0-SNAPSHOT</bundle>
        <bundle start-level="80">mvn:com.zsmartsystems.zigbee/com.zsmartsystems.zigbee/1.3.8</bundle>
        <bundle start-level="80">mvn:com.zsmartsystems.zigbee/com.zsmartsystems.zigbee.dongle.ember/1.3.8</bundle>
        <bundle start-level="80">mvn:com.zsmartsystems.zigbee/com.zsmartsystems.zigbee.dongle.telegesis/1.3.8</bundle>
        <bundle start-level="80">mvn:com.zsmartsystems.zigbee/com.zsmartsystems.zigbee.dongle.cc2531/1.3.8</bundle>
        <bundle start-level="80">mvn:com.zsmartsystems.zigbee/com.zsmartsystems.zigbee.dongle.xbee/1.3.8</bundle>
        <bundle start-level="80">mvn:com.zsmartsystems.zigbee/com.zsmartsystems.zigbee.console/1.3.8</bundle>
        <bundle start-level="80">mvn:com.zsmartsystems.zigbee/com.zsmartsystems.zigbee.console.ember/1.3.8</bundle>
        <bundle start-level="80">mvn:com.zsmartsystems.zigbee/com.zsmartsystems.zigbee.console.telegesis/1.3.8</bundle>
    </feature>
</features>

Maybe the karaf-maven-plugin has a configuration property to override the feature name. We can also add a dependency in the openhab-binding-zigbee feature on the generated feature. Or if all else fails, just change the artifactId to openhab-binding-zigbee ;-)

cdjackson commented 3 years ago

Updating the artifactId seems simplest - I assume there's no other dependency on this, and it resolves the issue.

wborn commented 3 years ago

I think the org.openhab.binding.zigbee.serial should also be added to the POM so it is added to the generated feature?

I tried installing the add-on but it was not happy:

org.apache.felix.resolver.reason.ReasonException: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=openhab-binding-zigbee; type=karaf.feature; version="[3.0.0.SNAPSHOT,3.0.0.SNAPSHOT]"; filter:="(&(osgi.identity=openhab-binding-zigbee)(type=karaf.feature)(version>=3.0.0.SNAPSHOT)(version<=3.0.0.SNAPSHOT))" [caused by: Unable to resolve openhab-binding-zigbee/3.0.0.SNAPSHOT: missing requirement [openhab-binding-zigbee/3.0.0.SNAPSHOT] osgi.identity; osgi.identity=org.openhab.binding.zigbee.ember; type=osgi.bundle; version="[3.0.0.202010030953,3.0.0.202010030953]"; resolution:=mandatory [caused by: Unable to resolve org.openhab.binding.zigbee.ember/3.0.0.202010030953: missing requirement [org.openhab.binding.zigbee.ember/3.0.0.202010030953] osgi.wiring.package; filter:="(osgi.wiring.package=org.openhab.binding.zigbee.serial)"]]

cdjackson commented 3 years ago

Ah - good point - this is a change from the OH2 binding as I split this into a separate bundle.

cdjackson commented 3 years ago

What artifactId needs changing?

wborn commented 3 years ago

If we want to follow some sort of naming convention for feature artifactIds it would be nice if we can find a way to make Karaf generate feature name independent of the artifactId. But there are already a couple of naming schemes so it's nice to have.

Another improvement may be to also use feature validation of the Karaf Maven plugin which would prevent issues such as that missing org.openhab.binding.zigbee.serial bundle.