Running a 5.1.0-SNAPSHOT bundle on 5.0.1

I noticed that dependencies for 5.1-SNAPSHOT has been updated.

A bundle built in the SNAPSHOT environment now requires GSON 2.131. instead of 2.11.
This means this bundle does not start anymore on a 5.0.1 build, but the combo 5.0.1 base + a 5.1.0-SNAPSHOT bundle is very common (at least for users, which requires bug fixes that are not included in the 5.0.1 bundle).

How could we provide a convenient way for users

  • having installed 5.0.1 distro
  • dropping a 5.1.0-SNAPSHOT bundle in the adding folder for installtion
  • and resolving the GSON 2.13.1 dependency?

@wborn any idea?

1 Like

Maybe the JAR works with both when you use 5.0.1 as ohc.version in your 5.1.0-SNAPSHOT branch?

Speaking only for my roborock binding, I’m seeing the same issues as @markus7017 .

I tried building with:

mvn clean install -Dohc.version=5.0.1

and get a long list of errors

same with me

esp. due to the fact that we have to expect a longer peroid of time for 4.x users moving to 5.0 or even 5.1 there should be a good guidance for binding developers

Iā€˜m currently preparing

  • checkout latest 5.1 brach
  • switch distro (demo app) and addons to 5.0.x branch
  • remove the 5.0.2 bundles/org.binding.xxx/src folder
  • copy latest binding code into the 5.0.2 bundles/org.binding.xxx/src folder (keep the existing pom.xml)
  • build the 5.0.2-SNAPSHOT.jar (mvn clean install)
  • copy to a 5.0.1 installation

If this works it would at least be a way that can be scripted to build 5.1 and 5.0.2 snapshots based on the same code. Iā€˜m doing the same to build a 4.3.6 snapshot, but this requires some adaption of the code.

The maintainers should keep those aspects in mind when changing dependencies.

It looks like a work around. My binding was build the described way and starts on OH 5.0.1
At least a solution, maybe someone has also a smarter idea

1 Like

I guess the only option for now is to create a 5.0 branch and cherry-pick updates, bit of a PITA :frowning:

Hi

I know this category is for developers only, not sure I would call myself that after only one binding and I’m pretty green.

I have run into a problem trying to build a binding specifically against openHAB5.0.0. in order to support another user and this thread/topic seemed relevant.

I read the guidance here Developers Guide and have forked in Github and cloned to my local machine and branched.

My OS is Win 11 and I can build against the 5.1.0-SNAPSHOT using the VSCode tasks on the Command pallet and through the terminal no problem and the JAR executes/debugs fine, but now I want to build for 5.0.0.

I note from the Developers Guide the -Dohc.5.0.0 option for Maven and have tried

mvn -Dohc.version=5.0.0 clean install -pl :org.openhab.binding.sunsynk -am

This fails

PS C:\Users\leech\Development\openhab-addons\bundles\org.openhab.binding.sunsynk> mvn -Dohc.version=5.0.0 clean install  -pl :org.openhab.binding.sunsynk -am  
[INFO] Scanning for projects...
[INFO] 
[INFO] -------< org.openhab.addons.bundles:org.openhab.binding.sunsynk >-------
[INFO] Building openHAB Add-ons :: Bundles :: SunSynk Binding 5.1.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.311 s
[INFO] Finished at: 2025-09-05T16:12:15+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase ".version=5.0.0". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: pre-clean, clean, post-clean, validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-site, site, post-site, site-deploy. -> [Help 1]
[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/LifecyclePhaseNotFoundException
PS C:\Users\leech\Development\openhab-addons\bundles\org.openhab.binding.sunsynk> mvn -Dohc.version=5.0.0 clean install -pl :org.openhab.binding.sunsynk -am  
[INFO] Scanning for projects...
[INFO] 
[INFO] -------< org.openhab.addons.bundles:org.openhab.binding.sunsynk >-------
[INFO] Building openHAB Add-ons :: Bundles :: SunSynk Binding 5.1.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  1.360 s
[INFO] Finished at: 2025-09-05T16:13:59+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Unknown lifecycle phase ".version=5.0.0". You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: pre-clean, clean, post-clean, validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-site, site, post-site, site-deploy. -> [Help 1]
[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/LifecyclePhaseNotFoundException

I have tied the -X option for mvn but there appeared to be nothing pertinent there nor at the [Help 1] URL. I’ve tried to find info about the -D but google has little to say on the subject other than it can be use to set a system property like a key value pair for reference from pom.xml, so I’m guessing this ā€˜ohc.version’ key is specific to openhab.

Interestingly, and this could be a red herring, when I added a space after the -D like this

mvn -D ohc.version=5.0.0 clean install -pl :org.openhab.binding.sunsynk -am

the build appears to progress further not throwing the confusing ā€œunknown lifecycle phaseā€ problem above and references some articles labelled with 5.0.0 e.g.

 mvn:org.openhab.core.bundles/org.openhab.core.model.rule.runtime/5.0.0

but ultimately fails with

[ERROR] Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.4.8:verify (karaf-feature-verification) on project org.openhab.binding.sunsynk ...

I found this thread [SOLVED] Maven build fails at 'verify' task - #3 by QNimbus ,but my features.xml looks fine to my novice eye.

<?xml version="1.0" encoding="UTF-8"?>
<features name="org.openhab.binding.sunsynk-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
		<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository>

	<feature name="openhab-binding-sunsynk" description="SunSynk Binding" version="${project.version}">
		<feature>openhab-runtime-base</feature>
		<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.sunsynk/${project.version}</bundle>
	</feature>
</features>

Not sure where to go, am I doing something wrong, is this the correct thread.

Help appreciated.

On Windows try using -D after the goals, e.g.:

mvn clean install -Dohc.version=5.0.0

Thanks for comming back so quickly

Sorry should have said I’ve tried that but for completeness I’ve retried

mvn clean install -Dohc.version=5.0.0 -pl :org.openhab.binding.sunsynk -am
mvn clean install -pl :org.openhab.binding.sunsynk -am -Dohc.version=5.0.0
mvn clean install -pl :org.openhab.binding.sunsynk -Dohc.version=5.0.0 -am

All fail with

[ERROR] Unknown lifecycle phase ā€œ.version=5.0.0ā€. You must specify a valid lifecycle phase or a goal in the format :

And with the space

mvn clean install -D ohc.version=5.0.0 -pl :org.openhab.binding.sunsynk -am
mvn clean install -pl :org.openhab.binding.sunsynk -am -D ohc.version=5.0.0
mvn clean install -pl :org.openhab.binding.sunsynk -D ohc.version=5.0.0 -am

all fail with

[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:01 min
[INFO] Finished at: 2025-09-05T23:20:49+01:00
[INFO] ------------------------------------------------------------------------
[INFO] Static code analysis summary report is available in:
[INFO] file:/C:/Users/leech/Development/openhab-addons/bundles/org.openhab.binding.sunsynk/target/summary_report.html
[ERROR] Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.4.8:verify (karaf-feature-verification) on project org.openhab.binding.sunsynk: Feature resolution failed for [openhab-binding-sunsynk/5.1.0.SNAPSHOT]      
[ERROR] Message: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=openhab-binding-sunsynk; type=karaf.feature; version=5.1.0.SNAPSHOT; filter:="(&(osgi.identity=openhab-binding-sunsynk)(type=karaf.feature)(version>=5.1.0.SNAPSHOT))" [caused by: Unable to resolve openhab-binding-sunsynk/5.1.0.SNAPSHOT: missing requirement [openhab-binding-sunsynk/5.1.0.SNAPSHOT] osgi.identity; osgi.identity=openhab-runtime-base; type=karaf.feature [caused by: Unable to resolve openhab-runtime-base/5.0.0: missing requirement [openhab-runtime-base/5.0.0] osgi.identity; osgi.identity=openhab-core-model-item; type=karaf.feature [caused by: Unable to resolve openhab-core-model-item/5.0.0: missing requirement [openhab-core-model-item/5.0.0] osgi.identity; osgi.identity=org.openhab.core.model.item; type=osgi.bundle; version="[5.0.0,5.0.0]"; resolution:=mandatory [caused by: Unable to resolve org.openhab.core.model.item/5.0.0: missing requirement [org.openhab.core.model.item/5.0.0] osgi.wiring.bundle; osgi.wiring.bundle=org.eclipse.xtext.common.types; filter:="(osgi.wiring.bundle=org.eclipse.xtext.common.types)" [caused by: Unable to resolve org.eclipse.xtext.common.types/2.37.0.v20241119-0857: missing requirement [org.eclipse.xtext.common.types/2.37.0.v20241119-0857] osgi.wiring.bundle; osgi.wiring.bundle=org.objectweb.asm; bundle-version="[9.7.1,9.8.0)"; filter:="(&(osgi.wiring.bundle=org.objectweb.asm)(bundle-version>=9.7.1)(!(bundle-version>=9.8.0)))"]]]]]
[ERROR] Repositories: {
[ERROR]         file:C:\Users\leech\Development\openhab-addons\bundles\org.openhab.binding.sunsynk\target/feature/feature.xml
[ERROR]         mvn:org.apache.karaf.features/framework/4.4.8/xml/features
[ERROR]         mvn:org.apache.karaf.features/specs/4.4.8/xml/features
[ERROR]         mvn:org.apache.karaf.features/standard/4.4.8/xml/features
[ERROR]         mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/5.0.0/xml/features
[ERROR]         mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-tp/5.0.0/xml/features
[ERROR]         mvn:org.ops4j.pax.web/pax-web-features/8.0.33/xml/features
[ERROR] }
[ERROR] Resources: {
[ERROR]         mvn:com.fasterxml.jackson.core/jackson-annotations/2.18.2
[ERROR]         mvn:com.fasterxml.jackson.core/jackson-core/2.18.2
[ERROR]         mvn:com.fasterxml.jackson.core/jackson-databind/2.18.2

Any further help appreciated.

I’m not a developer either with just one forum binding for Midea ACs. Anyway mvn clean install -pl :org.openhab.binding.mideaac -Dohc.version=5.0.0worked for me on the windows github desktop. I asked copilot why and this is what it said. Maybe help?

:brain: Why mideaac Worked but sunsynk Failed

From the surrounding page content, the issue with sunsynk isn’t the Maven command syntax itself (you’ve already nailed that), but rather how the binding’s Karaf feature is structured and what it depends on:

:white_check_mark: mideaac Binding

  • Appears to have clean dependency alignment with openHAB 5.0.0.

  • Its features.xml likely references only core bundles that are present and resolvable in the 5.0.0 repositories.

  • No transitive dependency on problematic bundles like org.eclipse.xtext.common.types or org.objectweb.asm.

:cross_mark: sunsynk Binding

  • The build fails during Karaf feature verification, not compilation.

  • The error trace shows a cascade of unresolved dependencies:

    • openhab-runtime-base → openhab-core-model-item → org.openhab.core.model.item → org.eclipse.xtext.common.types → org.objectweb.asm
  • The final blocker is a missing version range for org.objectweb.asm (needs 9.7.1 but not 9.8.0), which isn’t satisfied in the 5.0.0 repo.

:magnifying_glass_tilted_left: What This Tells Us

  • The sunsynk binding is more tightly coupled to DSL rule engine components, which rely on Xtext and ASM—both of which are sensitive to versioning.

  • mideaac is likely more self-contained or uses simpler runtime features that don’t trigger these deep dependency chains.

:hammer_and_wrench: Possible Workarounds

  • Manually override the problematic bundle versions in your local Maven repo or Karaf feature file (risky but doable).

  • Temporarily disable Karaf feature verification using:

    bash

    mvn clean install -pl :org.openhab.binding.sunsynk -Dskip.karaf.verify=true -Dohc.version=5.0.0 -am
    
    

    This skips the karaf-maven-plugin:verify phase, allowing you to build the JAR even if the feature resolution fails.

Thanks for helping out here. It appears the reason I could not build to openHAB 5.0.0 was that I was missing the 5.0.0 tag/branch, anyway I resolved the issue via git.

Add upstream remote

git remote add upstream https://github.com/openhab/openhab-addons.git

Fetch Tags

git fetch upstream --tags

Checkout 5.0.0

git checkout tags/5.0.0 -b my-5.0.0-branch

build

mvn clean install -pl :org.openhab.binding.sunsynk -am

Have a feeling this may have been a hammer to crack a nut.

For anyone else coming across this, to debug you will need also to modify your tasks.json to point at the openhab runtime in this case version 5.0.1.

1 Like

How far away is a 5.1 Milestone release? There some improvements to bindings I use in 5.0.1 that I would like to try out, but I’m not brave enough to try the Snapshot.

M1 will come probably this Sunday, though there hasn’t been agreed on that proposal.

1 Like

I come across issues with small dependency updates causing all kind of havoc ā€œall the timeā€. I’m wondering if it would be better to do all these incremental updates in a separate branch and then update main in larger batches. It certainly would save me a lot of hours of building, since when you check out different branches that are based on slightly different main commits, the whole shebang often chokes and both core and addons must be built in its entirety. Having to spend 2 hours to switch between branches feels like a waste of time to me.

Another possibility I guess is that ranges were used for dependencies. As far as I know, Maven will always pick the ā€œlatestā€ version that the range allows if it can, so bumping the upper limit of the range should still effectively bump the version used for full builds, but it would maybe allow things to be a bit less rigid when trying to mix and match while developing.