I’ve also managed to get a working Eclipse environment for the Verisure binding that is WIP using the demo application and then importing the Verisure binding project in Eclipse.
The binding uses an external lib jsoup-1.11.3.jar
that is present in the openhab2-addons/bundles/org.openhab.binding.verisure/lib
folder:
jannegpriv in /Users/jannegpriv/git/openhab2-master/git/openhab2-addons/bundles/org.openhab.binding.verisure (4788-verisure) (12 entries, 3 hidden)
$ ll lib/
total 1248
-rw-r--r--@ 1 jannegpriv staff 241622 May 6 22:29 gson-2.8.5.jar
-rw-r--r-- 1 jannegpriv staff 395748 May 4 21:38 jsoup-1.11.3.jar
It compiles fine in Eclipse and when commenting out the import for org.jsoup and all other rows using jsoup the binding starts up without errors and I can debug via the app/Debug OSGi button and launch PaperUI and start to configure my things.
However when trying to use the org.jsoup functionality the framework starts up with the following error:
! Failed to start bundle org.openhab.binding.verisure-2.5.0.201905072051, exception Could not resolve module: org.openhab.binding.verisure [123]
Unresolved requirement: Import-Package: org.jsoup; version="[1.11.0,2.0.0)"
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.verisure [123]
Unresolved requirement: Import-Package: org.jsoup; version="[1.11.0,2.0.0)"
at org.eclipse.osgi.container.Module.start(Module.java:447)
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:431)
at aQute.launcher.Launcher.startBundles(Launcher.java:528)
at aQute.launcher.Launcher.activate(Launcher.java:427)
at aQute.launcher.Launcher.run(Launcher.java:306)
at aQute.launcher.Launcher.main(Launcher.java:152)
My binding pom.xml looks like this:
$ cat pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.openhab.addons.bundles</groupId>
<artifactId>org.openhab.addons.reactor.bundles</artifactId>
<version>2.5.0-SNAPSHOT</version>
</parent>
<artifactId>org.openhab.binding.verisure</artifactId>
<name>openHAB Add-ons :: Bundles :: Verisure Binding</name>
<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.11.3</version>
<scope>provided</scope>
</dependency>
</dependencies>
</project>
NOTE: The documentation has a typo for the end-tag regarding scope <scope>provided</provided>
I’ve also updated the feature.xml file in the features/openhab-addons/src/main/feature/feature.xml
:
<feature name="openhab-binding-verisure" description="Verisure Binding" version="${project.version}">
<feature>openhab-runtime-base</feature>
<feature>openhab-transport-http</feature>
<bundle dependency="true">mvn:org.jsoup/jsoup/1.11.3</bundle>
<bundle dependency="true">mvn:com.google.gson/gson/2.8.5</bundle>
<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.verisure/${project.version}</bundle>
</feature>
I would also like to use a newer version of gson (2.8.5) that I also have included, since I get a parsing error for a json when using the OH version compared to a local test using gson-2.8.5.jar.
What am I missing?