Can't find a working ssh client library that will pass karaf-feature-verification

Working on a new ddwrt plugin. trying to build it on ssh. The two ssh client libs I tried seem to depend on deprecated packages

jsch seems to be most popular but it depends on org.newsclub.net.unix which I can’t resolve

[ERROR] Message: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=openhab-binding-ddwrt; type=karaf.feature; version=4.3.4.SNAPSHOT; filter:="(&(osgi.identity=openhab-binding-ddwrt)(type=karaf.feature)(version>=4.3.4.SNAPSHOT))" [caused by: Unable to resolve openhab-binding-ddwrt/4.3.4.SNAPSHOT: missing requirement [openhab-binding-ddwrt/4.3.4.SNAPSHOT] osgi.identity; osgi.identity=org.openhab.binding.ddwrt; type=osgi.bundle; version="[4.3.4.202503102229,4.3.4.202503102229]"; resolution:=mandatory [caused by: Unable to resolve org.openhab.binding.ddwrt/4.3.4.202503102229: missing requirement [org.openhab.binding.ddwrt/4.3.4.202503102229] osgi.wiring.package; filter:="(osgi.wiring.package=org.newsclub.net.unix)"]]

feature.xml:

<?xml version="1.0" encoding="UTF-8"?>
<features name="org.openhab.binding.ddwrt-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
	<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository>

	<feature name="openhab-binding-ddwrt" description="ddwrt Binding" version="${project.version}">
		<feature>openhab-runtime-base</feature>
		<bundle dependency="true">mvn:com.github.mwiede/jsch/0.2.23</bundle>
		<bundle dependency="true">mvn:org.bouncycastle/bcprov-jdk18on/1.80</bundle>
		<bundle dependency="true">mvn:org.newsclub.net/junixsocket/1.3</bundle>
		<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.ddwrt/${project.version}</bundle>
	</feature>
</features>

tried apache sshd which is used by eclipse but ran into issue with sun.security.x509 see The net.i2p.crypto.eddsa 0.3.0 bundle has bad OSGi metadata · Issue #15 · eclipse-orbit/orbit-simrel · GitHub

<?xml version="1.0" encoding="UTF-8"?>
<features name="org.openhab.binding.ddwrt-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
	<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository>

	<feature name="openhab-binding-ddwrt" description="ddwrt Binding" version="${project.version}">
		<feature>openhab-runtime-base</feature>
		<bundle dependency="true">mvn:org.apache.sshd/sshd-osgi/2.15.0</bundle>
		<bundle dependency="true">mvn:net.i2p.crypto/eddsa/0.3.0</bundle>
		<bundle dependency="true">mvn:sun.security.x509</bundle>
		<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.ddwrt/${project.version}</bundle>
	</feature>
</features>

Metadata can be amended with wrap protocol (wrap:mvn:…), see:

Its important to mark wrap protocol feature as a prerequisite, once you do that with few (hundreds) attempts you might be able to pass validation.

I tried several different ways and nothing works

<?xml version="1.0" encoding="UTF-8"?>
<features name="org.openhab.binding.ddwrt-${project.version}" xmlns="http://karaf.apache.org/xmlns/features/v1.4.0">
	<repository>mvn:org.openhab.core.features.karaf/org.openhab.core.features.karaf.openhab-core/${ohc.version}/xml/features</repository>

	<feature name="openhab-binding-ddwrt" description="ddwrt Binding" version="${project.version}">
		<feature prerequisite="true">wrap</feature>
		<feature>openhab-runtime-base</feature>
		<bundle>wrap:mvn:org.apache.sshd/sshd-osgi/2.14.0&amp;overwrite=merge&amp;Import-Package=!org.apache.tomcat.*,*</bundle>
		<bundle start-level="80">mvn:org.openhab.addons.bundles/org.openhab.binding.ddwrt/${project.version}</bundle>
	</feature>
</features>

The first part after mvn: url should be dollar sign. Rest of it looks fine. Try this: <bundle>wrap:mvn:org.apache.sshd/sshd-osgi/2.14.0$overwrite=merge&amp;Import-Package=!org.apache.tomcat.*,*</bundle>

Thanks I got a little further but stuck on org.apache.tomcat.jni

	<bundle>wrap:mvn:org.apache.sshd/sshd-osgi/2.15.0$overwrite=merge&amp;Import-Package=org.apache.tomcat.jni;resolution:="optional",org.bouncycastle.*;resolution:="optional",net.i2p.crypto.*;resolution:="optional",*</bundle>
[ERROR] Failed to execute goal org.apache.karaf.tooling:karaf-maven-plugin:4.4.6:verify (karaf-feature-verification) on project org.openhab.binding.ddwrt: Feature resolution failed for [openhab-binding-ddwrt/4.3.4.SNAPSHOT]
[ERROR] Message: Unable to resolve root: missing requirement [root] osgi.identity; osgi.identity=openhab-binding-ddwrt; type=karaf.feature; version=4.3.4.SNAPSHOT; filter:="(&(osgi.identity=openhab-binding-ddwrt)(type=karaf.feature)(version>=4.3.4.SNAPSHOT))" [caused by: Unable to resolve openhab-binding-ddwrt/4.3.4.SNAPSHOT: missing requirement [openhab-binding-ddwrt/4.3.4.SNAPSHOT] osgi.identity; osgi.identity=org.openhab.binding.ddwrt; type=osgi.bundle; version="[4.3.4.202503192132,4.3.4.202503192132]"; resolution:=mandatory [caused by: Unable to resolve org.openhab.binding.ddwrt/4.3.4.202503192132: missing requirement [org.openhab.binding.ddwrt/4.3.4.202503192132] osgi.wiring.package; filter:="(osgi.wiring.package=org.apache.tomcat.jni)"]]

Are you sure you need it? Your binding, or one of dependencies you embedded in it, is trying to make use of it.

Got it working after reading Binding with complex dependencies - #5 by Sonic I removed any changes to feature.xml and updated my pom.xml as follows:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/POM/4.0.0"
  xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">

  <modelVersion>4.0.0</modelVersion>

  <parent>
    <groupId>org.openhab.addons.bundles</groupId>
    <artifactId>org.openhab.addons.reactor.bundles</artifactId>
    <version>4.3.4-SNAPSHOT</version>
  </parent>

  <artifactId>org.openhab.binding.ddwrt</artifactId>

  <name>openHAB Add-ons :: Bundles :: ddwrt Binding</name>

  <properties>
    <bnd.importpackage>org.apache.tomcat.jni;resolution:="optional",org.bouncycastle.*;resolution:="optional",sun.security.x509;resolution:="optional"</bnd.importpackage>
  </properties>

  <dependencies>
    <dependency>
      <groupId>org.apache.sshd</groupId>
      <artifactId>sshd-osgi</artifactId>
      <version>2.15.0</version>
    </dependency>
    <!-- For ed25519 support -->
    <dependency>
      <groupId>net.i2p.crypto</groupId>
      <artifactId>eddsa</artifactId>
      <version>0.3.0</version>
    </dependency>
  </dependencies>

</project>

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