New Telegram Binding - Tester and Feedback welcome

Hey @J-N-K,

thanks for asking. From my point of view, the binding is almost ready. At least the readme needs some more information. In the last days/weeks I struggled a lot with the update/migration to the new bnd build system. I ran into the same issues as other users have stated in

And I agree that it is quite frustating that for 3rd party and non OSGi libraries it seems to be quite difficult to get it running or there seems to be non documented workarounds.

If I create a simple Eclipse Maven project that makes use of the TelegramBot library (without OH), the only thing I need to do is to add

<dependency>
       <groupId>org.telegram</groupId>
       <artifactId>telegrambots</artifactId>
       <version>4.2</version>
   </dependency>

to the pom.xml.

For my OH binding I also added:

    <feature name="openhab-binding-telegram" description="Telegram Binding" version="${project.version}">
        <feature>openhab-runtime-base</feature>
        <feature prerequisite="true">wrap</feature>
        <bundle dependency="true">wrap:mvn:org.telegram/telegrambots/4.2$Bundle-Name=Telegram%20Bot%20Library&amp;Bundle-SymbolicName=org.telegram.telegrambots&amp;Bundle-Version=4.2</bundle>
       <bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.telegram/${project.version}</bundle>
    </feature>

to the features.xml.

But then I get the following error after mvn clean install:

[WARNING] Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=openhab-binding-telegram; type=karaf.feature; version=2.5.0.SNAPSHOT; filter:=“(&(osgi.identity=openhab-binding-telegram)(type=karaf.feature)(version>=2.5.0.SNAPSHOT))” [caused by: Unable to resolve openhab-binding-telegram/2.5.0.SNAPSHOT: missing requirement [openhab-binding-telegram/2.5.0.SNAPSHOT] osgi.identity; osgi.identity=org.openhab.binding.telegram; type=osgi.bundle; version=“[2.5.0.201905261629,2.5.0.201905261629]”; resolution:=mandatory [caused by: Unable to resolve org.openhab.binding.telegram/2.5.0.201905261629: missing requirement [org.openhab.binding.telegram/2.5.0.201905261629] osgi.wiring.package; filter:=“(osgi.wiring.package=org.telegram.telegrambots.meta)”]]

As far as I understand from the different forum threads, the last osgi.wiring.package means that a dependency is missing. So, I also added this to the pom.xml:

	<dependency>
	    <groupId>org.telegram</groupId>
	    <artifactId>telegrambots-meta</artifactId>
	    <version>4.2</version>
	    <scope>provided</scope>
	</dependency>

and this to the feature.xml:

<bundle dependency="true">wrap:mvn:org.telegram/telegrambots-meta/4.2$Bundle-Name=Telegram%20Bot%20Meta%20Library&amp;Bundle-SymbolicName=org.telegram.telegrambots-meta&amp;Bundle-Version=4.2</bundle>

Then the maven build is successful. However, I would like to know why because as mentioned above, it is not required in a simple non OH Maven project.

Anyway, when I try to run the app.bndrun and add the binding to the “Run Requirements” I end up with some more osgi errors like:

Resolution failed. Capabilities satisfying the following requirements could not be found:
[<>]
⇒ osgi.identity: (osgi.identity=org.openhab.binding.telegram)
⇒ [org.openhab.binding.telegram version=2.5.0.201905261645]
⇒ osgi.wiring.package: (&(osgi.wiring.package=org.telegram.telegrambots))
[org.apache.aries.jpa.container version=2.7.0]
⇒ osgi.service: (objectClass=javax.persistence.spi.PersistenceProvider)
[org.openhab.binding.harmonyhub version=2.5.0.201905250635]
⇒ osgi.wiring.package: (&(osgi.wiring.package=com.digitaldan.harmony)(&(version>=1.1.0)(!(version>=2.0.0))))
[net.minidev.accessors-smart version=1.2.0]
⇒ osgi.wiring.package: (&(osgi.wiring.package=org.objectweb.asm)(&(version>=5.0.0)(!(version>=6.0.0))))
[org.openhab.binding.smartmeter version=2.5.0.201905250646]
⇒ osgi.wiring.package: (&(osgi.wiring.package=io.reactivex)(&(version>=2.2.0)(!(version>=3.0.0))))
[org.openhab.core.test version=2.5.0.201905250302]
⇒ osgi.wiring.package: (&(osgi.wiring.package=org.junit))
[org.openhab.transform.jinja version=2.5.0.201905250653]
⇒ osgi.wiring.package: (&(osgi.wiring.package=com.hubspot.jinjava))
[org.openhab.transform.bin2json version=2.5.0.201905250653]
⇒ osgi.wiring.package: (&(osgi.wiring.package=com.igormaznitsa.jbbp))

In some threads I also read that I have to add a dependency to that binding in pom.xml of the demo app. Is that still valid? I also read that I should add it to “Run Bundles”, but in Eclipse IDE | openHAB it is not mentioined anymore. Is this still required? I don’t know how often I setup my build environment already because I saw some changes in the addons, distro or demo github project.

Sorry if I didn’t post these issues earlier, but I thought I can solve it myself. For me the new build environment seems to be more complex than the old one. Although, I have to say that with other bindings which don’t make use of of any dependencies like the astro binding I don’t have any problems to compile/run them.

You can find the current migration here: https://github.com/ZzetT/openhab2-addons/tree/master/bundles/org.openhab.binding.telegram
But I don’t want to create a PR with something that is not working with the new build environment.