ikvm icon indicating copy to clipboard operation
ikvm copied to clipboard

class is not found with IKVM and IKVM.Maven although the Java packages contain it

Open martin-honnen opened this issue 6 months ago • 2 comments

In the project https://github.com/martin-honnen/Saxon12NetEXPathHttpClientTest1 I use IKVM and IKVM.Maven.Sdk to try to use several Java packages from Maven:

  <ItemGroup>
    <PackageReference Include="IKVM" Version="8.11.2" />
    <PackageReference Include="IKVM.Maven.Sdk" Version="1.9.3">
      <PrivateAssets>all</PrivateAssets>
      <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
    </PackageReference>
  </ItemGroup>

  <ItemGroup>
    <!--<PackageReference Include="SaxonHE12s9apiExtensions" Version="12.7.9" />-->
    <MavenReference Include="net.sf.saxon:Saxon-HE" Version="12.7" />
    <MavenReference Include="org.apache.httpcomponents:httpcore" Version="4.4.14" />
    <MavenReference Include="org.expath.http.client:http-client-java" Version="1.5.2" />
    <MavenReference Include="org.expath.tools:tools-java" Version="0.8.0" />
    <MavenReference Include="org.expath.tools:tools-saxon" Version="0.8.1" />
    <MavenReference Include="org.expath.packaging:pkg-java" Version="2.1.1" />
    <MavenReference Include="org.expath.packaging:pkg-saxon" Version="2.1.1" />
    <MavenReference Include="org.expath.http.client:http-client-saxon" Version="1.5.2" />

  </ItemGroup>

The code then fails to use the class/instantiate the class org.expath.httpclient.saxon.SendRequestFunction() as it is not found in the namespace org.expath.httpclient.saxon.

Any ideas what could be wrong or how to fix it?

The class structure in Java is that there is an abstract class net.sf.saxon.lib.ExtensionFunctionDefinition extended by another abstract class org.expath.pkg.saxon.EXPathFunctionDefinition then implemented by org.expath.httpclient.saxon.SendRequestFunction.

martin-honnen avatar Jun 21 '25 10:06 martin-honnen

So the dependency is to this: https://repo1.maven.org/maven2/org/expath/http/client/http-client/1.5.2/http-client-1.5.2.pom

I am not totally sure what this mean in Maven-land. A POM with no actual jars, no dependencies, only a <modules> entry. It sounds like you're supposed to pick one or something. So maybe it's a way to do an optional dependency? I can't find docs on it.

wasabii avatar Jun 23 '25 19:06 wasabii

I think the class org.expath.httpclient.saxon.SendRequestFunction is in https://repo1.maven.org/maven2/org/expath/http/client/http-client-saxon/1.5.2/http-client-saxon-1.5.2.pom, the class org.expath.pkg.saxon.EXPathFunctionDefinition is in org.expath.packaging:pkg-saxon i.e. https://repo1.maven.org/maven2/org/expath/packaging/pkg-saxon/2.1.1/pkg-saxon-2.1.1.pom.

martin-honnen avatar Jun 24 '25 12:06 martin-honnen