New Binding Dependencies HELP!

Hi all,
Im trying to develop a binding to pull microsoft todo (can be extended to all microsoft apps) binding for openhab.
I have got a POC working for the main code in my “Playground” so have tried to move it over into openhab as a binding.

im trying to follow this: https://www.openhab.org/docs/developer/buildsystem.html#adding-dependencies
But am currently getting no where.

I tried adding them one by one into features.xml but get to a point where it fails on a dep i dont know what it is or where to find it.
I have also tried gathering all dependencies (by running dependency:copy-dependencies) and droping them in the lib folder but again it then fails for a package i cant find anywhere.
All my code is here:

Any help would be really appreciated! pulling my hair out here!

Thanks,
Xen

Unfortunately the documentation you referenced is not fully up to date. The current version is

If you follow these instructions, are you still experiencing problems?

Code updated on github…
Does this manage transitives as well? or do i have to manually add each to the pom?
Ive removed all the feature stuff i put in. and instead simply fixed up jenkins versions (same way as was done in another binding)
but now it is failing to verify due below: im pretty sure that nothing else is using Microsoft graph so dont think there is a conflicting version here

[ERROR] Message: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=openhab-binding-microsofttodo; type=karaf.feature; version=2.5.5.SNAPSHOT; filter:="(&(osgi.identity=openhab-binding-microsofttodo)(type=karaf.feature)(version>=2.5.5.SNAPSHOT))" [caused by: Unable to resolve openhab-binding-microsofttodo/2.5.5.SNAPSHOT: missing requirement [openhab-binding-microsofttodo/2.5.5.SNAPSHOT] osgi.identity; osgi.identity=org.openhab.binding.microsofttodo; type=osgi.bundle; version="[2.5.5.202005080711,2.5.5.202005080711]"; resolution:=mandatory [caused by: Unable to resolve org.openhab.binding.microsofttodo/2.5.5.202005080711: missing requirement [org.openhab.binding.microsofttodo/2.5.5.202005080711] osgi.wiring.package; filter:="(osgi.wiring.package=com.microsoft.graph.httpcore)"]]

Github updated…
From looking around it seems that you do need to manually add al transitive dependencies.
I am going through updating the pom, seeing what fails updating the pom repeat.
Is there a better way to do this? Can you confirm i am on the correct path now and not doing something else super silly!
Also is there an easy way to go from package failure error message to required dependency? some are difficult to deduce where they are coming from.

Thanks :slight_smile:

I find this the most difficult part of setting up dependencies, and I’ve not found a better way to do it. Once I figured out to stop trying to read the whole error message and just look at the last bit, it got a little better (but not much). Hopefully someone will chime in with a better approach.

The latest dependency im stuck on seems to be a java lib…
Not sure how i would go about adding this?
com.sun.jndi.dns

@wborn, may I ask you to have a look here. According to https://mvnrepository.com/artifact/com.microsoft.graph/microsoft-graph/1.7.1 the microsoft-graph bundle depends on jersey, which you recently removed from addons. So you think we can solve this somehow?

There are several options:

  • Seems there is already msgraph-sdk-java#328 to get it removed so maybe a small PR can fix it upstream?
  • If that isn’t resolved quickly we could create our own bundle for it and use that
  • Another option is to add the sources of microsoft-graph to the add-on and rework the code to remove the dependency on Jersey, like we did for lametrictime and sleepiq
1 Like

So for my understanding, sorry if these are stupid A’s

What do you mean by PR,
What is the issue with the jersey dependency?
How do you know that that is what has caused this issue?
What do you mean by creating our own bundle? Is this an OSGI bundle?
Final one you mean cloning the repo for ask, copying it in, and then adjusting the code so we can get rid of Jersy?
What would we want to use instead?

Thanks,
Alex

Pull request to fix the dependency issue in that library. As you can read in the issue others are also not happy about it, so if it’s fixed in the Microsoft repo everybody will be happy again. :slight_smile:

It’s a huge dependency. It’s a specific implementation that won’t be available in OH3 anymore when openhab-core#1443 is merged. It doesn’t make sense for a client library to depend on such server dependencies.

Yes an OSGi bundle that’s the same as the current one but with a fix to remove that dependency. I.e. a fork of the Microsoft code.

Copying in the Java classes that you use in your add-on and putting them in a 3rdparty dir so the origin/license is clear. When Microsoft fixes the issue you can remove that code and use their bundle again.

Got you,
And is there anyway of knowing that this is the issue without simply knowing that this is a huge dependency and cause issues haha?
Like what could I have seen in the logs that showed that this was the main pain point?

right,
So i’ve just added all the microsoft files under a loc pacakge called third party,
Not sure if ive screwed something, but it it still all compiling without the jersy dep.

Its still failing due to other dependencies in OSGI, am i back on the right path now?
(github updating)
Thanks,
Alex

Ive gone through all transitive deps on maven repo,
Not sure if i’m being an idiot but not sure where all these google ones are coming from!
current one is “com.google.appengine.api”

realised i was being an idiot and not paying attention to version in the dpe tree. updating now…

right, so final update of the day haha.
Ive gone through all the transative dependencies and added them in,
Ive removed jersey from the pom of the microsoft graph and added the whole project to the forked openhab.

I am now having issues with:
[ERROR] C:\Users\gener\IdeaProjects\openhab-addons3\bundles\org.openhab.binding.microsofttotodo\pom.xml [0:0]: Classes found in the wrong directory: {META-INF/versions/9/module-info.class=module-info}
I added
<configuration> <rules><dependencyConvergence/></rules> </configuration>

to the maven enforcer plugin to help remove conflicting versions.
All the dependencies in the new binding are on the same version, the only conflicting versions seem to be in the core bundles. But i am still seeing the error above.
Any ideas?
(Github updated)

I have decided to just reverse eng the whole oauth flow and write it in plain java, using jetty that i beleive is already included in openhab

2 Likes

fyi, managed to get it all working,
Not release’able yet as all of the config is hardcoded but i may be able to tidy it up this weekend and put up a poc if people are interested?

1 Like

This topic was automatically closed 41 days after the last reply. New replies are no longer allowed.