Binding compile error on OH3

I’ve upgraded to openHab 3 and I’m trying to build my Awair binding for this version. I’m stuck on this error that appears right at the end. Do I need to get the latest snapshot for it to work?

[WARNING] The POM for org.openhab.core.bom:org.openhab.core.bom.compile:pom:3.0.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.openhab.core.bom:org.openhab.core.bom.openhab-core:pom:3.0.0-SNAPSHOT is missing, no dependency information available
[WARNING] The POM for org.openhab.core.bom:org.openhab.core.bom.test:pom:3.0.0-SNAPSHOT is missing, no dependency information available

[ERROR] Failed to execute goal on project org.openhab.binding.awair: Could not resolve dependencies for project org.openhab.addons.bundles:org.openhab.binding.awair:jar:3.0.0-SNAPSHOT: The following artifacts could not be resolved: org.openhab.core.bom:org.openhab.core.bom.compile:pom:3.0.0-SNAPSHOT, org.openhab.core.bom:org.openhab.core.bom.openhab-core:pom:3.0.0-SNAPSHOT, org.openhab.core.bom:org.openhab.core.bom.test:pom:3.0.0-SNAPSHOT: Failure to find org.openhab.core.bom:org.openhab.core.bom.compile:pom:3.0.0-SNAPSHOT in https://openhab.jfrog.io/openhab/libs-snapshot was cached in the local repository, resolution will not be reattempted until the update interval of openhab-snapshot has elapsed or updates are forced ->

Modify your pom.xml and change 3.0.0-SNAPSHOT to 3.2.0-SNAPSHOT.

I think that implies updating the whole bundle package again so it’s all aligned to 3.2.0, right?

What’s the quickest way to do that?

All you need to do is edit the file and rebuild

That generates new errors, I guess because the rest of the bundles are at 3.0.0:

[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for org.openhab.addons.bundles:org.openhab.binding.awair:3.2.0-SNAPSHOT: Could not find artifact org.openhab.addons.bundles:org.openhab.addons.reactor.bundles:pom:3.2.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 7, column 11
 @
[ERROR] The build could not read 1 project -> [Help 1]
[ERROR]
[ERROR]   The project org.openhab.addons.bundles:org.openhab.binding.awair:3.2.0-SNAPSHOT (E:\Documents\Programming\OpenHab\openhab-3.0.0.0\git\openhab-addons\bundles\org.openhab.binding.awair\pom.xml) has 1 error
[ERROR]     Non-resolvable parent POM for org.openhab.addons.bundles:org.openhab.binding.awair:3.2.0-SNAPSHOT: Could not find artifact org.openhab.addons.bundles:org.openhab.addons.reactor.bundles:pom:3.2.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 7, column 11 -> [Help 2]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/ProjectBuildingException
[ERROR] [Help 2] http://cwiki.apache.org/confluence/display/MAVEN/UnresolvableModelException
Clean install...
[INFO] Scanning for projects...
[ERROR] [ERROR] Some problems were encountered while processing the POMs:
[FATAL] Non-resolvable parent POM for org.openhab.addons.bundles:org.openhab.binding.awair:3.2.0-SNAPSHOT: Could not find artifact org.openhab.addons.bundles:org.openhab.addons.reactor.bundles:pom:3.2.0-SNAPSHOT and 'parent.relativePath' points at wrong local POM @ line 7, column 11

In the end I had to reinstall Eclipse and pull down the latest bundle snapshot. Then I got it to compile. There’d been a lot of moving around of the furniture, what with modified dependencies and so on, so I had to change quite a bit of the code to get it compiled OK.

Now my problem is, when the binding is deployed (having cleaned the cache first), I get this in the log:

2021-07-28 14:37:33.421 [WARN ] [org.apache.felix.fileinstall        ] - Error while starting bundle: file:/usr/share/openhab/addons/org.openhab.binding.awair-3.2.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.awair [29]
  Unresolved requirement: Import-Package: org.openhab.core.cache

	at org.eclipse.osgi.container.Module.start(Module.java:463) ~[org.eclipse.osgi-3.16.200.jar:?]
	at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:440) ~[org.eclipse.osgi-3.16.200.jar:?]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1260) [bundleFile:3.6.8]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1233) [bundleFile:3.6.8]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:520) [bundleFile:3.6.8]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:365) [bundleFile:3.6.8]
	at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:316) [bundleFile:3.6.8]

I haven’t been able to find a solution here. Any hints?

I imagine I need to put some other .jar in the addons folder…?

Is everyone on holiday already? :smirk:

The only reference I can find to the error on the forum is with reference to a compatibility layer for add-ons from previous versions, but that shouldn’t apply here, since it’s an OH3 version of the binding.

I just realised: I compiled the binding using the 3.2.0 snapshot, but I’m on 3.1.0. I imagine that might be the problem…?

@hilbrand Sorry to bother you, but I’m pretty sure you know the answer to this one :slightly_smiling_face:

I tried getting openhab-addons 3.1.0 from github but I just get a ton of errors when trying to compile. Need help.

For the moment I’m going to have to get the Awair readings by HTTP request and forget about the binding.