I tried to build the Shelly Binding based on the current repo (OH5), which fails
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.13.0:compile (default-compile) on project org.openhab.binding.tradfri: Compilation failure: Compilation failure:
[ERROR] /Users/markus/Dev/openhab-5/git/openhab-addons/bundles/org.openhab.binding.tradfri/src/main/java/org/openhab/binding/tradfri/internal/handler/TradfriGatewayHandler.java:[33,8] The import org.eclipse.californium.scandium.config.DtlsConfig cannot be resolved
[ERROR] /Users/markus/Dev/openhab-5/git/openhab-addons/bundles/org.openhab.binding.tradfri/src/main/java/org/openhab/binding/tradfri/internal/handler/TradfriGatewayHandler.java:[76,9] DtlsConfig cannot be resolved
[ERROR] /Users/markus/Dev/openhab-5/git/openhab-addons/bundles/org.openhab.binding.tradfri/src/main/java/org/openhab/binding/tradfri/internal/handler/TradfriGatewayHandler.java:[162,17] org.eclipse.californium.elements.config cannot be resolved
[ERROR] /Users/markus/Dev/openhab-5/git/openhab-addons/bundles/org.openhab.binding.tradfri/src/main/java/org/openhab/binding/tradfri/internal/handler/TradfriGatewayHandler.java:[163,30] DtlsConfig cannot be resolved to a variable
[ERROR] /Users/markus/Dev/openhab-5/git/openhab-addons/bundles/org.openhab.binding.tradfri/src/main/java/org/openhab/binding/tradfri/internal/handler/TradfriGatewayHandler.java:[164,30] DtlsConfig cannot be resolved to a variable
[ERROR] /Users/markus/Dev/openhab-5/git/openhab-addons/bundles/org.openhab.binding.tradfri/src/main/java/org/openhab/binding/tradfri/internal/handler/TradfriGatewayHandler.java:[194,21] org.eclipse.californium.elements.config cannot be resolved
Have the Californium components been removed from default dependencies?
feature.xml includes
Cannot find the declaration of element âprojectâ,
which could be fixed by ticking
Preference â Maven â tick the option (âdownload artifact javadocâ)
File:Import:Existing Maven Project:Shelly binding
Maven->Update project
Still same issue (import Californium failed)
I See
âââ
Conflicting lifecycle mapping (plugin execution biz.aQute.bnd:bnd-maven-plugin:7.1.0:bnd-process (execution: default, phase: process-classes)): Mapping defined in âbndtools.m2e_7.1.0.202411251545 [18]â and âorg.eclipse.m2e.pde.connector_2.2.0.20241001-1350 [380]â. To enable full functionality, remove the conflicting mapping and run Maven->Update Project Configuration.|pom.xml|/org.openhab.binding.shelly|line 7|Maven Project Build Lifecycle Mapping Problem
âââ
in the build errors.
Hello Markus,
I am sorry to see your struggle. Since you started to get compilation issue straight from maven, it is important to confirm if same issue occurs in CI/CD pipeline. If not then it is environment specific and we can look for differences causing these.
The openHAB 5 branch is Java 21, but 4.x should be still fine with Java 17. What may be different is californium version used in OH 4.x and 5. This will impact directly bindings which rely on dependencies provided by OH transport.
Also, if you are building everything locally - make sure you have also a fresh build of OH core for given version. Sometimes snapshots are getting stale and mixed all together (local maven repo vs remote repos), leading to inconsistent output from the build.
Finally - if you will push your changes somewhere, I could try to reproduce it and help you with the fix.
I always build bindings from command line using i.e. mvn package -pl :org.openhab.binding.shelly (if I need it), so if any other bindings fail, I can simply ignore error and still get binding I need.
The main thing to note, because californium got a major update you most likely wonât get exactly same code working with OH 4.x and 5.x. You can still try to cherry-pick changes between branches for places which rely on OH or Californium API which remained same between californium 2.7 and 4.x. So while you may cherry-pick changes between OH branches, the build needs to follow types available there, and you wonât be able to build from single branch 2 versions targeting different runtime.
I built tradfri binding from 4.3.x and main branch (5.0.0-SNAPSHOT) without any issues, with one note - I used command line.