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)

Not really, I did:
For openHAB 4.3.x

export JAVA_HOME=/usr/lib/jvm/java-17-openjdk/
cd openhab-core
git checkout 4.3.x
mvn clean install
cd openhab-addons
git checkout 4.3.x
mvn clean install

For openhab 5.0.x

export JAVA_HOME=/usr/lib/jvm/java-21-openjdk/
cd openhab-core
git checkout main
mvn clean install
cd openhab-addons
git checkout main
mvn clean install

So I did not try to compile main branch with Java 17 yet.

that’s a good approach to keep those changes within the corresponding code base and make sure to have the 100% OH4 environment.

However, I need Eclipse for debugging
and the OH4 setup shows the same problem

  • Fresh IDE install based on OH5
  • Switch openhab-addons and openhab-bistro to 4.3.x branch
  • need to change from 4.3.1-SNAPSHOT to 4.3.5-SNAPSHOT in pom.xml of the demo app (a glitch, but could be handled)
  • Start Eclipse → all good so far
  • import binding
  • Maven:Update project
  • Eclipse shows the lifecycle problem + unable to resolve dependencies (see above)

How do you do your debugging?

So far, I couldn’t fine a proper setup with OH5 or OH4 environment to get back to development. Maybe it’s related to macOS, I think I tried all other aspects (different Eclipse releases, different binding, deleted .m2/.p2/.bnd/.eclipse folder, 2nd machine, main branch + my fork)

Any other idea?

Could you please try a fresh IDE install so we know if
a) works for you incl. Eclipse
b) is related to macOS or not
c) my machine/personal setup

Many thanks for getting into this, looking forward to the break-through :slight_smile:

@Nadahar Do you have an idea?

I’m not able to get a fresh IDE install to build and debug the Shelly binding (part of the list) even I did it already 100 times in the past.

I’m reluctant to test this myself since compiling OHC takes some time, but as long as you’re using all 4.3.x branches (for core, distrib, addons, webui etc.) it should work. What I’ve found is that when switching to a different commit, you need to rebuild everything that has changed in projects that aren’t open in Eclipse, using Maven from the command line. So, when switching between 5.x and 4.x, it basically means to rebuild everything.

The quickest way of doing that is to run, from the repository root:

mvn clean install -T1C -DskipTests -DskipChecks -Dspotless.check.skip=true

This will install artifacts in your local maven repo (home/.m2) of the given version, so that when Maven tries to resolve dependencies, it will find them.

I always do that before even attempting Maven → Update project.

I will add that since rebuilding everything is quite time-consuming, I think a better approach might be to have multiple git repo clones locally, e.g “core 5.x” and “core 4.x”. You can import additional projects in Eclipse using Import → Existing Maven Project. You can specify which JDK to use on a per-project basis in Eclipse, so you could permanently assign JDK17 to the “4.x branches”. Again, this is untested, but I think it should work as long as you don’t open both the “4.x” and “5.x” version of the same project in Eclipse simultaneously.

When it comes to building OH5.x using -P17 I don’t understand how that could work. People eager to prevent backwards compatibility have done various updates to the code to use Java21 specific syntax, so the current “main” code can’t compile with Java17.

thanks for the quick response

yep, having separate OH4 and OH5 clones is the way I’ll go. This will fix the Californium problem, because the new version requires changes to 1 code file.

However, I’m still struggling to do a build/debug in Eclipse, even in the OH4 folder.
Whatever I try I see an error in the binding’s pom.xml

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

I even tried a 2nd machine, which never had an Eclipse/OH installation.