1
votes

Preambule:

I would like to setup a NuGet repository hosted inside of my company.
We already had a Nexus OSS 2.13 running so I tried setting up a Nuget hosted repository on it, and uploaded my package there to test it. I then configured NuGet repos on my Visual Studio 2015 in order to add the one on that nexus server.
The problem I encountered then is that VS2015 uses (apparently) nuget feed v3, while Nexus 2.13 has the v2 feed. The symptom was a 404 error while browsing the nexus repository (when nuget calls repo_url/Search()).
The error message looked like : The v2 feed at '/nexus nuget repository url/Search()?[...]' returned '404 not found'

Browsing it through the repo url in a web browser (without /Search()) works fine, and so is browsing repo_url/FindPackagesById.
I tried downgrading my NuGet vsix version as much as possible, going down to v3.1.1, but no version worked with the v2 feed.

What I tried next:

I looked up Sonatype website about nexus, and saw Nexus v3 is said to handle NuGet, while v2 has no such mention. I decided to try and install Nexus 3 next to our Nexus 2.13 (on the same machine) and see what it had to offer. I downloaded v3.0.2-02 from that same page as above and started setting it up. I followed parts of the documentation on how to install it skipping some parts that were already done because of the v2.13 installation. (Disclaimer: I did not install v2.13 myself though I considered installing java runtime environment and stuff like that to be a given).

I then started nexus 3 as a service and successfully reached the home page and logged in as admin.

Having read a statement on hosted repository management in the documentation saying:

By default, the repository manager ships with the following configured hosted repositories:
[...]
nuget-hosted
   This hosted repository is where your organization can publish internal 
   releases in repository using the NuGet repository format. You can also 
   use this repository for third-party components that are not available in 
   external repositories, that could potentially be proxied to gain access 
   to the components.

I headed to Repository -> Repositories section and clicked "Create repository".

Only maven (group/hosted/proxy) and raw (group/hosted/proxy) recipes are available. No Nuget, no npm, nothing else than maven...

Searching a bit, I found in the System -> Bundles section that the bundle for nuget repositories mvn:com.sonatype.nexus.plugins/nexus-repository-nuget/3.0.2-02 is listed as Installed
while maven's mvn:org.sonatype.nexus.plugins/nexus-repository-maven/3.0.2-02 is listed as Active.

I tried looking for a place where bundles can be activated, and thought I found one at $NEXUS_HOME/etc/startup.properties where the first line says:

# Bundles to be started on startup, with startlevel

and contains line looking the one I added to try and activate nuget:

mvn\:com.sonatype.nexus.plugins/nexus-repository-nuget/3.0.2-02 = 10

I then used > sudo service nexus3 restart to restart nexus v3, logged back into admin, went to Repositories, and saw that still no nuget recipe is available.
I went back to Bundles and saw the nuget bundle is still listed as Installed and not Active.
I'm now all out of ideas as to what I could or should do in order to simply create a hosted nuget repository, which should already be available according to nexus' documentation...

What am I missing?
What is wrong with a fresh install missing what the documentation is saying is available by default?
How do I create a hosted NuGet repository on that nexus v3?

1
In the top left of the Repository Manager UI, there should be a version string. If you could, what does your say? It SHOULD say OSS 3.0.2-02 if you are running OSS, but it almost seems like it's booting as what we call "Base" internally.DarthHater
It does say OSS 3.0.2-02. I finally found a way to start nexus-repository-nuget, i will try to post an answer on mondayEregrith
That's odd, it shouldn't need started (it should start by default). If you can recreate the initial state, can you post an issue at issues.sonatype.org/browse/NEXUS with your nexus.log file? We'd like to look at this.DarthHater
I'll have a look at that. There also was a v3.0.0 installed on the same machine that gave me the exact same result. The log shows nothing weird, just says it starts maven and raw among other things, but no word about nuget.Eregrith
We also tried to add to the core feature xml the bit about nuget found in another feature xml, but it did nothing.Eregrith

1 Answers

1
votes

I found a way to activate the nexus-repository-nuget plugin:

Activate karaf console in file bin/nexus.vmoptions :

-Dkaraf.startLocalConsole=true

Then start nexus with the run option:

sudo bin/nexus run

And finally in the karaf console, activate nexus-repository-nuget bundle:

bundle:start 214

Now just quit the console and stop the runner, and start as a service. The bundle should be "Activated" and you should be able to create a nuget repository.