OH4: dependency bundles not included anymore?

Hallo,
in OH3 dependecy bundles for a binding where included in the binding jar: for example the bundle
openwebnet4j-x.y.z.jar was included in the openwebnet binding jar at build time.

It looks like if I now build the binding in OH4, the dependendcy is not included anymore in the jar causing the loading of the binding to fail if put it in the addons folder.
Is this a wanted change? If yes, where was it described/announced?

How is the dependency resolved then by OH4?

Did you try with

mvn clean install karaf:kar

So yu would compile a kar file with all dependencies.

When libraries with scope compile in the pom.xml, not the jar is included, but the files from that jar are put into the binding jar. That has not changed.

Yes with the .kar it works and the binding get loaded with its dependency.

However, going back to the generated .jar:
OH4_dependency
The first jar was generated from a OH4 build, and it does not have the dependency lib
The second jar was generated from a OH3 build and as you can see has the openwebnet4j lib included.

looking at the pom.xml:

 <dependency>
      <groupId>io.github.openwebnet4j</groupId>
      <artifactId>openwebnet4j</artifactId>
      <version>0.9.1</version>
      <scope>compile</scope>

it still has the library as compile dependency.

So @hilbrand : why is the OH4 build process not considering it?
(I am on OH4 main branch)

I would suspect here changes caused by BND behavior. If you have same POM and same dependency declaration but different contents of generated bundle then, in my humble opinion, blame goes to bnd-maven-plugin, or change in its configuration.

My personal suspect is: Upgrade bnd to 6.4.0 (#3205) · openhab/openhab-core@9c3e2f3 · GitHub
Check if reverting this change makes any difference for you.

I have no explanation why you don’t have the lib included. I compiled the binding when writing my previous answer and that build had the library included in the 4.0.0 branch.

For the kar file It’s also strange. Kar files are only relevant if the dependencies are specified in the feature file. That isn’t the case here. Therefore I don’t understand why a kar file would work. Unless the library code is included in the kar version. But that would be strange on why it won’t be available in the jar file. Did you check the openHAB automatic build version if that contains the library?

I might have the same issue, but it might also be my inexperience with the dependency system.
Trying to build the xmmplclient to create a testable JAR.

I created the build, dropped it in the addons fodler and it cannot start due to missing dependency. I would have thought that while dropping the jar, the dependency would have been satisfied by karaf.
Declaration:

<dependency>
      <groupId>org.igniterealtime.smack</groupId>
      <artifactId>smack-java7</artifactId>
      <version>${smack.version}</version>
      <scope>provided</scope>
    </dependency>

So i changed it to compile and rand the same mvn clean install:

<dependency>
      <groupId>org.igniterealtime.smack</groupId>
      <artifactId>smack-java7</artifactId>
      <version>${smack.version}</version>
      <scope>compile</scope>
    </dependency>

Result is the same 22kb file size, and dropping the jar gives the same error. I would have expected a larger file with all dependency’s or Karaf satisfying the dependency’s

I can confirm that after a full re-build (mvn clean install), both the generated jar and kar files contain the classes of the dependency lib which is declared with scope compile.
So it may have been a temporary glitch perhaps in the interaction between BND and Eclipse…

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