Problem dependencies

I have set up the new IDE.
Successfully build the jar.
But when i install the jar i receive

org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.smhi [86]
  Unresolved requirement: Import-Package: com.google.gson; version="[2.8.0,3.0.0)"

How do i add dependency to gson?

This is because the current snapshot has a newer gson version than is in the release version of openHAB. A workaround is to create a lib directory in your binding directory and put a gson jar (version 2.8 or higher) in that lib directory and build the binding again. Do not commit or put this jar in git as it’s a workaround to make the binding work with the current release version of openHAB.

You could also install the dependency manually on the karaf console:

bundle:install http://central.maven.org/maven2/com/google/code/gson/gson/2.8.5/gson-2.8.5.jar 
4 Likes

That link is not working.
I used bundle:install https://repo1.maven.org/maven2/com/google/code/gson/gson/2.8.5/gson-2.8.5.jar
I hope this may help someone else

1 Like