Californium removed?

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

		<feature>openhab-transport-coap</feature>

@wborn Any idea?

If you have a fork update it:

https://github.com/openhab/openhab-addons/pull/18214

I did a fresh install (no fork)

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.

Do we still need to downgrade to BND tools 7.0?

I was able to compile by adding

    <bnd.importpackage>org.eclipse.californium.core</bnd.importpackage>
    <bnd.importpackage>org.eclipse.californium.scandium.config</bnd.importpackage>

to pom.xml

@wborn Is that the way to go?

and I still see

Conflicting lifecycle mapping (plugin execution "biz.aQute.bnd:bnd-maven-plugin:7.1.0:bnd-process (execution: default, phase: process-classes)")...

Do we still need to downgrade to BND tools 7.0?

ok, I found out that I’m able to compile using Java 21, but not with Java 4 for OH 4.x

I’m frustrated

  • same issue with a different binding
  • same issue with openHAB Core
  • even after cleaning .m2+.p2 repo completely and re-install of the IDE

I’m using Eclipse 2024-12 on macOS.

@wborn @hilbrand any idea?

I did another test:

  • complete fresh system (Eclipse was never been installed there)
  • fresh IDE setup

A build with Java 21 runs well,
a build with “mvn install -Pj17 -Dohc.version=4.3.0” fails
same

I also tried to add the dependency to Californium 2.7.4

  <dependencies>
    <dependency>
      <groupId>org.eclipse.californium</groupId>
      <artifactId>californium-core</artifactId>
      <version>2.7.4</version>
    </dependency>
  </dependencies>

same

:frowning:

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.

Thanks for picking this up.

  • Yes, Java 21 is installed and shows with „java -version“
  • So far I didn‘t do any changes, it‘s just the initial build from a fresh install
  • On the 2nd system Eclipse nor OH was installed, some no leftovers from previous builds
  • I just to do a local build; Java 21 works , when using the -P17 it fails with the described issue
  • Yes, OH4 uses Californium 2.7.4, I think OH5 uses 4.x

Reproducing should be easy

  • Fresh install of the IDE with addons+dev, no core repos
  • In Eclipse you should see the error pom.xml
  • Run mvn clean install in the bundles/orf.openhab.binding.shelly
  • and mvn install -Pj17 -Dohc.version=4.3.0
  • this should show the compilation errors

By the way: The Tradfi binding has the same issue

@splatch Any hint, would be very appreciated, otherwise my development is blocked

Hi
I am not a developer
 But i am seeing these errors on OH 5.0.0.SNAPSHOT

Maybe gives s hint on what is wrong?

nope, that’s a log from the runtime
I could even not build it
but thanks anyways

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.

Cheers,
Ɓukasz

1 Like

so you are using the 4.3.x and 5.0.0 branch in parallel?

Did you successfully build Tradfi with -P17 -ohc.version=4.3.0 from OH5 branch?
(I saw exactly the same problem as with Shelly)

What’s the recommended way to build jars for OH4?

Is there a way to setup a fresh OH4 build environment?

Fresh IDE setup

  • binding builds on cli with success
  • try to resolve dependencies in eclipse - fails!! (without adding the Shelly Binding)