Selvin solution (in the question comments) was working but I did not succeed improving it to manage several Maven Repositories neither manage several files to unzip so I end-up with my own package.
It can surely be improved but it is a start.
Inspired by Selvin solution:
- First you need to install the package
dotnet add package NMaven
- Then you can add as many repository as required in your csproj:
<MavenRepository Include="Repository" Url="https://path.to.your/repository" />
- Then you can add as many maven dependencies
<MavenReference Include="artifact-id" GroupId="group.id" Version="X.Y.Z.R" />
- Finally add as many deployment rules as required:
<NMavenDeployment Include="DeploymentRule" ArtifactId="artifact-id" Files="path/to/file.ext" Destination="Destination/Folder" />
Here is the working example shown in the github where we extract the manifest file of a maven dependency and print it in a console.
<ItemGroup>
<MavenRepository Include="Mvn-Repo" Url="https://repo1.maven.org/maven2" />
<MavenReference Include="commons-compress" GroupId="org.apache.commons" Version="1.23.0" />
<NMavenDeployment Include="MANIFEST.MF" ArtifactId="commons-compress" Files="MANIFEST.MF" Destination="Resources" />
</ItemGroup>