How to automatically enable IO.SOCKET IO.SOCKET.ENGINE without enabling openhabcloud?

Tags: #<Tag:0x00007fc20e6707f0>

Hi,

I have developed a custom bundle that requires Io.Socket and IO.Socket.Engine libs. In my Eclipse IDE, i have no problem to run the custom bundle as both IO.Socket libs are in maven dependency repository.

However, when i move the custom bundle that requires Io.Socket libs to openhab2.5 distribution, it fails to run as the environment do not have these 2 libs/bundles. Unless I install openhabclound bundle, how do i enable io.sockets without installing opencloud?

Have you added the dependencies?

Did you add the features in the feature.xml? See what openhabcloud does? https://github.com/openhab/openhab-addons/blob/2.5.x/bundles/org.openhab.io.openhabcloud/src/main/feature/feature.xml
And then build a kar file instead of a jar file.

Yes, those dependencies are included in feature.xml file:

<feature>openhab-runtime-base</feature>
        <bundle dependency="true">mvn:org.json/json/20180813</bundle>
        <bundle dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.jsr305/3.0.2_1</bundle>
        <bundle dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.okhttp/3.8.1_1</bundle>
        <bundle dependency="true">mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.okio/1.13.0_1</bundle>
        <bundle dependency="true">mvn:org.openhab.osgiify/io.socket.socket.io-client/1.0.0</bundle>
        <bundle dependency="true">mvn:org.openhab.osgiify/io.socket.engine.io-client/1.0.0</bundle>
        <bundle dependency="true">mvn:javax.websocket/javax.websocket-api/1.1</bundle>

But did you build a kar file? mvn karaf:kar

Im trying to but now i am hitting a problem with mvn command because i am changing this line i guess " <repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository>" in feature but my bundle is for 2.5

java.io.IOException: Error resolving artifact org.openhab.core.features.karaf:org.openhab.core.features.karaf.openhab-core:jar:3.0.0-SNAPSHOT: [Could not find artifact org.openhab.core.features.karaf:org.openhab.core.features.karaf.openhab-core:jar:3.0.0-SNAPSHOT in openhab-snapshot (https://openhab.jfrog.io/openhab/libs-snapshot/)]

What is the version in your root pom.xml? There are currently 2 branches master and 2.5.x. make sure your code is based on the 2.5.x branch.

2.5.0-SNAMPSHOT

<parent>
            
    
    <groupId>org.openhab.addons</groupId>
            
    
    <artifactId>org.openhab.addons.reactor</artifactId>
            
    
    <version>2.5.0-SNAPSHOT</version>
          
  
  </parent>

I got it resolved by changing the version to 2.5.1-SNAPSHOT. However, with KAR, the bundle ends up in the feature list instead of bundle list and it seems that I need to go paperui to install the bundle

Make sure your feature is defined as follows:

<feature name="openhab-xyz-binding" install="auto">
....
</feature>

It should affect processing of KAR file.