How to publish NuGet and Jar files from jenkins to Nexus

We are building NuGet packages and Jar files in our CI server (Jenkins).
How can we publish those to repositories in Nexus 3?

The official Nexus Platform plugin only seems to support Maven2 artifacts.

We currently do not use Maven so that plugin is not an option.

There is an alternative plugin available that claims to support artifacts other than maven2 but AFAICT it only supports maven2 as well.

What options are there to publish NuGet packages from jenkins?
I also tried to use dotnet nuget push from a jenkins pipeline but that fails:

error: Response status code does not indicate success: 502 (Bad Gateway).

Brem, are you familiar with the documentation for our Jenkins plugin?
https://help.sonatype.com/integrations/nexus-and-continuous-integration/nexus-platform-plugin-for-jenkins

Hi @mprescott,

Yes I found that, even installed the plugin and configured it until I found the small remark in Publish / Deploy Components:

The following repository formats are supported by the publisher:

  • Maven 2 release repositories

As I wrote we do not use maven so this plugin is not an option for us.

You could try the REST API - Components API

But also note that “nuget push” will work just fine… the 502 response indicates some sort of network issue, likely outside of Nexus Repo.

Hi @rseddon,

Thanks. Managed to get the “nuget push” to work.

The 502 response was not caused by a network issue. I am using jenkins credentials to store the API key and something went wrong with that. And the incorrect API key resulted in the 502 (Bad Gateway) error.

This combined with the fact that the same command (but using the correct API key) from the same system with the same user did work caused great confusion.

I hope you (Sonatype) can fix it so that an incorrect/expired API key will return 401 (Unauthorized) instead of 502 (Bad Gateway). That would have pointed me in the right direction!