Export / Import Repository by API


How to generate an json file which can be used to import them at a new nexus3 instance?

The import via script is described here: Examples.

But the export of the repos via API looks like:

    "name": "maven-central",
    "format": "maven2",
    "type": "proxy",
    "url": "www.xyz.de"

The command, which I used to create this, was:

curl -X GET "http://server:port/nexus/service/rest/v1/repositories" -H "accept: application/json"

And this format isn’t accepted when I try to import.

Only this format seems to be accepted for the import:

  "name": "npm",
  "type": "groovy", 
  "content": "repository.createNpmHosted('npm-internal'); repository.createNpmProxy('npmjs-org','https://registry.npmjs.org'); repository.createNpmGroup('npm-all',['npmjs-org','npm-internal'])"