Trying to update a dependency

Tags: #<Tag:0x00007f6173d48790> #<Tag:0x00007f6173d48600>

Hi there,
as I recently managed to upgrade my openhab to 2.x (2.2 currently), I’d like to migrate my diyonxbee binding to be a native openhab 2 binding (the old version doesn’t work well in oh2). My very first problem is that I’d like to add a 3rd party dependency, which on it’s own depends on rxtx which, as far as I read, is provided in openhab2 via <feature>openhab-transport-serial</feature>. The library I want to use is not a OSGI bundle.

The question is, how I can resolve this.

  • Do I manually add the OSGI descriptors to that bundle? (would that mean I have to fork it?)
  • Or could I use the wrap mechanism?

Thanks in advance for any guidance.

It should be enough to add the dependency to the binding-pom with scope default. It then gets embedded and you do not have to take care of the feature (except adding the serial feature).

I just tried that but It doesn’t work - I might have a misunderstanding. Would anybody mind lookging at my attempt (github) ?

My fault. Scope should be compile. What exactly do you mean by “not working”? Please show the maven log

trying with scope compile gives me:

$ mvn -pl :org.openhab.binding.diyonxbee compile
[INFO] Scanning for projects...
[INFO] 
[INFO] ------< org.openhab.addons.bundles:org.openhab.binding.diyonxbee >------
[INFO] Building openHAB Add-ons :: Bundles :: DiyOnXBee Binding 2.5.3-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[WARNING] The POM for org.rxtx:rxtx:jar:2.2 is missing, no dependency information available
[WARNING] The POM for org.rxtx:rxtx-native:jar:linux_x86_64:2.2 is missing, no dependency information available
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  5.468 s
[INFO] Finished at: 2020-03-01T15:48:21+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project org.openhab.binding.diyonxbee: Could not resolve dependencies for project org.openhab.addons.bundles:org.openhab.binding.diyonxbee:jar:2.5.3-SNAPSHOT: The following artifacts could not be resolved: org.rxtx:rxtx:jar:2.2, org.rxtx:rxtx-native:jar:linux_x86_64:2.2: Failure to find org.rxtx:rxtx:jar:2.2 in https://openhab.jfrog.io/openhab/libs-release was cached in the local repository, resolution will not be reattempted until the update interval of openhab-release has elapsed or updates are forced -> [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/DependencyResolutionException

Isn’t there anybody out being able to help me? To better explain my problem: I want to use a non-osgi library that depends on rxtx which seems to be provided by openhab’s transport-serial module. I just don’t manage to simply get the build for that dependency working.

thanks

  <dependencies>
    <dependency>
      <groupId>com.digi.xbee</groupId>
      <artifactId>xbee-java-library</artifactId>
      <version>1.3.0</version>
      <exclusions>
        <exclusion>
          <groupId>org.rxtx</groupId>
          <artifactId>rxtx</artifactId>
        </exclusion>
        <exclusion>
          <groupId>org.rxtx</groupId>
          <artifactId>rxtx-native</artifactId>
        </exclusion>
      </exclusions>
      <scope>compile</scope>
    </dependency>
  </dependencies>

I’m not 100% sure it works, but at least it removes the dependency to org.rxtx/rxtx/2.2 and compiles (after I fixed a wrong null-annotation).