Capabilities satisfying the following requirements could not be found:

With the latest changes the bundle requirements have changed so OSGi R7 features can be utilized (provided by Karaf 4.3.1). OSGi R7 support is one of the main Karaf 4.3 features. As a result you cannot use bundles with such requirements with OH 3.0.x or the 3.1.0 M1, M2, M3 milestones.

Is there a ways to go back with the current IDE installation? I didn’t explicitly defined those dependencies, I just want to start with a fresh install. Are the benefits received by new Karaf worth breaking backward compatibility?

You could try checking out the latest version of the main branch of openhab-distro and then add your binding again to the demo app pom.xml and app.bndrun files.

I’d say yes, without it we won’t be able to support the newer Java versions and multi-release JARs. The next Java LTS (v17) will be released in September.

If I understand correctly that would fix the issue that I couldn’t start it within the IDE, but the resulting jar would still not run on a 3.0/3.1M1…3 installation, correct?

Yes that’s right. An easy way to build a JAR compatible with those versions is to override the openHAB Core version to 3.0.1. E.g. build your 3.1.0-SNAPSHOT bundle on the command line with Maven and add the -Dohc.version=3.0.1 option. That way you can postpone creating a 3.0.x branch until it is really necessary.

2 Likes

I build the binding with

mvn -Dohc.version=3.0.1 clean install

but the user is still reporting this issue (we verified that he used the updated build).
details: Shelly Binding - #2099 by Daniel_O

For know I can’t create a new build, which could be installed on productive installations in the field. :sweat:

I tried https://github.com/markus7017/myfiles/blob/master/shelly/org.openhab.binding.shelly-3.1.0-SNAPSHOT.jar?raw=true with a 3.0.x instance and it indeed does not work.

If I build the shelly binding myself with -Dohc.version=3.0.1 it does work with a OH 3.0.1 instance. So looks like that JAR wasn’t build with that option.

1 Like

hmm, need to verify/double check
thanks for supporting this investigation

1 Like

@wborn I did a fresh IDE install and ran
“mvn clean install -Dohc.version=3.0.1”

same result

23:12:33.965 [WARN ] [org.apache.felix.fileinstall         ] - Error while starting bundle: file:/usr/share/openhab/addons/org.openhab.binding.shelly-3.1.0-SNAPSHOT.jar
org.osgi.framework.BundleException: Could not resolve module: org.openhab.binding.shelly [274]
  Unresolved requirement: Import-Package: org.osgi.framework; version="[1.9.0,2.0.0)"

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

@wborn

  • I tried running “mvn clean install -Dohc.version=3.0.1” vs. “mvn -Dohc.version=3.0.1 clean install” vs. 'mvn clean install -D “ohc.version=3.0.1”`and copied target/…jar to an 3.1M3’s addons folder
  • I tried to replace ${ohc.version} in feature.xml with “3.0.1” - same result
  • If I set ohc.version to 3.0.1-SNAPSHOT in openhab-addons/pom.xml see that the Download of 3.0.1 files starts
Downloading from openhab-snapshot: https://openhab.jfrog.io/openhab/libs-snapshot/org/openhab/core/bom/org.openhab.core.bom.compile/3.0.1-SNAPSHOT/maven-metadata.xml

so speifying ohc.version on command line seems to work in general
3.0.1 means regular release/non-SNAPSHOT so that’s ok

  • I don’t see anymore a download of 3.0.1 files, but I would expect that there are no changes anymore

I’m wondering that pom.xml specifies <karaf.version>4.3.1</karaf.version>. How does that relate to ohc.version. If the new Karaf version is explicitly specified I would gues that this create the dependency to OSGi 7.

Do I need to change any file in addition to specifying -Dohc.version=3.0.1 for mvn?
What else can I check (any log output from build showing the ohc-version)?

From my understanding other developers should face the same problem when doing a fresh install of the IDE. I did nothing special related to my binding.

  • Install Eclipse, Distro+Binding projects
  • Create a new branch
  • copy updated code files to org.openhab.binding.shelly
  • run “mvn clean install -Dohc.version=3.0.1”

By the way: I use Eclipse on Mac

Wouldn’t it make sense to provide the option to setup the IDE with a specific release version, so not just “2.5.x, 3.0” as selectable streams, but “2.5.x, 3.0.1, 3.1-SNAPSHOT”. Usually there is no need for a binding developer to have the lastest floating core release, especially when architectural things change. It should be possible to create a build environment, which matches the user scenartios: 3.0.1 + a new build of a binding or 3.1-SNAPSNOT_Mx if you require latest core features for your binding (in this case it’s clear that there is a dependency on the specific core release).

That’s strange because it does work for me like that without making any additional changes. :thinking:

Changing the ohc.version property overrides the versions of OHC Core BOMs used. Those BOMs manage what org.osgi.framework is used. It only seems to be an issue for add-ons with org.osgi.framework imports. E.g. I could use a 3.1.0-SNAPSHOT Nest binding (which doesn’t use these imports) without any issues with OH 3.0.1.

Maybe just create a branch from 3.0.x if it doesn’t work for you?

If there is a 2.5.x stream, I think a 3.0.x stream would make sense too. But I don’t use these streams myself, I just switch between branches. :slight_smile:

I did some more investigation

  • using a different machine
  • delete & fresh install of the IDE
  • important shelly binding as existing maven project to the IDE
  • set git upstream to my repo
  • run mvn from the main branch with -Dohc.version=3.0.1
  • saw downloading files with /3.0.1
  • build was successful
  • copied the shelly jar to a 3.1M3 (RPi4 with Zulu 11)
    and it works!!

BUT
(same machine)

  • I switchd to the Shelly 3.1-5 branch
  • ran the same mvn command
  • again a bunch of files were downloaded (mustly checksdtyle and findbug) - why? I’m pretty sure they didn’t changed within 10minutes
  • copied to the RPi
  • and it DOESN’T work, same issue unable to resolve the component

THEN

  • I repeated procediure 1 to delete and re-install the IDE
  • run mvn with -Dohc.version=3.0.1
  • build successful, but jar doesn’t run

I’m pretty sure I could repeat it 10 times and it will fail.

It seems that the initial build process runs well, but afterwards something is downloaded/updated, which adds a dependincy to the new OSGi version.

@wborn Could you do me a favor and repeat the test on your machine, but

  • build on the main branch with 3.0.1, try jar
  • switch to shelly_snapshort3.1-5 branch
  • build again for 3.0.1 core and try again

Are there any cached files I could delete - what’s about the bundle pool?

PS: Thanks for supporting me

I found the problem:

  • after deleting ~/.m2/repository/org/openhab
  • and always building with -Dohc.version=3.0.1

I’m now able to run multiple builds on both machines

Strange, but @wborn thanks for your supporgt :+1:

2 Likes

That’s good news it finally works for you too this way! :slight_smile:
Looks like somehow some wrong content ended up in your local Maven repo.

hi ,
i end up in the same situation.
i set up the IDE according instructions and end up an the error message.
even without adding my binding i do get this error
What needs to be done to get this resolved to be able to start OH3 in debug modus?

try to build your binding with “mvn clean install -Dohc.version=3.0.2”

hmm,

deleted the complete dev and again setup up and now the resolve works.
maybe something changed in the meanwhile.

thx anways

@wborn Again I ran into the issue twice. It seems that once you ran a regular mvn clean install (without -Dohc.version=3.0.2) some files in the repository get overwritten and afterwards you run in the sam issue even when building for 3.0.2. Last time I just deleted the org/openhab folder in the .m2 reporitory and was able to fix the issue

This time I’m no longer able to build for 2.5 after doing the same. This error shows up

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

I tried to run “mvn clean install -U”, but problem persists. Was anything in the 2.5 repo removed causing this problem?

The 2.5.x artifacts probably depend on Bintray repos which no longer exist now it has sunset.

@wborn Today I’m running into this error

[ERROR] Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.2.7:verify (karaf-feature-verification) on project org.openhab.binding.carnet: Feature resolution failed for [openhab-binding-carnet/3.1.0.SNAPSHOT]
[ERROR] Message: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=openhab-binding-carnet; type=karaf.feature; version=3.1.0.SNAPSHOT; filter:="(&(osgi.identity=openhab-binding-carnet)(type=karaf.feature)(version>=3.1.0.SNAPSHOT))" [caused by: Unable to resolve openhab-binding-carnet/3.1.0.SNAPSHOT: missing requirement [openhab-binding-carnet/3.1.0.SNAPSHOT] osgi.identity; osgi.identity=org.openhab.binding.carnet; type=osgi.bundle; version="[3.1.0.202105110617,3.1.0.202105110617]"; resolution:=mandatory [caused by: Unable to resolve org.openhab.binding.carnet/3.1.0.202105110617: missing requirement [org.openhab.binding.carnet/3.1.0.202105110617] osgi.wiring.package; filter:="(&(osgi.wiring.package=org.osgi.framework)(version>=1.9.0)(!(version>=2.0.0)))"]]
[ERROR] Repositories: {
[ERROR] 	file:/Users/markus/Dev/openhab-3/git/openhab-addons/bundles/org.openhab.binding.carnet/target/feature/feature.xml
[ERROR] 	mvn:org.apache.karaf.features/framework/4.2.7/xml/features
[ERROR] 	mvn:org.apache.karaf.features/standard/4.2.7/xml/features
[ERROR] 	mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/3.0.2/xml/features
[ERROR] 	mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-tp/3.0.2/xml/features
[ERROR] 	mvn:org.ops4j.pax.web/pax-web-features/7.2.11/xml/features
[ERROR] }

while running “mvn clean install -Dohc.version=3.0.2”. Nothing changed since yesterday evening except the binding code itself, just rebuild.

Was 3.0.2 removed from the build system?! In This case: How to build a binding, which runs on OH3.0.2 (stable release)?