ikvmnet / ikvm-maven

Support for adding dependencies on Maven artifacts to .NET projects, using IKVM.
MIT License
53 stars 5 forks source link

MavenReference missing #18

Closed mserioli closed 2 years ago

mserioli commented 2 years ago

Dear all,

I'm using IKVM.Maven.Sdk on a .net core 6 class library, in order to use Saxon-HE as follows: `

<MavenReference Include="net.sf.saxon:Saxon-HE" version="11.4" />
<MavenReference Include="org.xmlresolver:xmlresolver" Version="4.5.1" />
<MavenReference Include="org.xmlresolver:xmlresolver" Category="data" Version="4.5.1" />

`

If I build the project from Visual Studio 2022 everything's fine.

If I build my solution from dotnet.exe tool dotnet.exe build .\Proj\Proj.csproj -c Release

I do not have in the output directory of my application the following dependencies:

  • org.apache.commons.codec": "1.15.0.0"
  • org.apache.httpcomponents.client5.httpclient5": "5.1.0.0"
  • org.apache.httpcomponents.core5.httpcore5": "5.1.0.0"
  • org.apache.httpcomponents.core5.httpcore5.h2": "5.1.0.0"
  • org.xmlresolver.xmlresolver": "4.5.0.0"
  • org.xmlresolver.xmlresolver_data": "4.4.0.0"
  • slf4j.api": "1.7.0.0"
  • xml.apis": "1.4.0.0"

only Saxon.HE": "11.4.0.0" is there

And the generated App.deps.json file lacks them as well image image

Perhaps is there anything I'm missing on the execution of dotnet.exe build?

Thanks for your support

mserioli commented 2 years ago

A solution I found is to add the same dependencies in the project that is referencing the class library. Not elegant, but it works.

Thanks for any help

wasabii commented 2 years ago

So the issue here is a bug. The GetMavenReferenceItemsFromProjectReferences target, which is supposed to consult nested ProjectReferences, has a condition that prevents it from working outside Visual Studio. Fix should be made in develop.

wasabii commented 2 years ago

Looking at this code again after awhile has raised some questions for me about whether it should actually be recursive. Looks like _MSBuildProjectReferenceExistent already includes transitive projects. So maybe it only needs to go one level deep.

wasabii commented 2 years ago

This is resolved in 1.0.2.

mserioli commented 2 years ago

Thanks for the super fast support