Skip to content

Migrate from Nexus 3 to CloudRepo

cloudrepo-migrate nexus3 copies the hosted Maven, npm, PyPI and Docker repositories (Docker from version 0.6.0) of a Nexus Repository 3 server into CloudRepo, then checks every file against the original. It moves every file of a Maven repository, every wheel and sdist of a PyPI repository, every tag of a Docker repository and, for npm, every version of each package with its dist-tags. From version 0.8.0 it also moves a hosted raw repository you name with --repo SOURCE=TARGET into TARGET, a CloudRepo Maven repository, every file at the same path and served as it is, tested against a real Nexus 3 (sonatype/nexus3:3.76.0). See Raw repositories.

Used on this page only, never saved. Never enter a token or password here.

One command moves your Nexus 3 Maven, npm, PyPI and Docker repositories into CloudRepo, every file checksum-verified.

A dry run lists what would move and uploads nothing.

Terminal
cloudrepo-migrate nexus3 \
--nexus-url https://nexus.example.com \
--org your-org \
--dry-run

When the list looks right, run it for real:

Terminal
cloudrepo-migrate nexus3 \
--nexus-url https://nexus.example.com \
--org your-org \
--report-json report.json

Nexus is only read. It keeps running, unchanged, until you repoint your builds. Using an agent? Go to For agents. On Nexus 2? Use cloudrepo-migrate nexus2, the same tool with the same options.

  • A CloudRepo organization. No account yet? Start free trial. 14 days free. No credit card required.
  • A repository in CloudRepo for each Nexus repository you move, of the same format. Give it the Nexus repository’s name, or map the names with --repo. A CloudRepo repository name has lowercase letters, digits, _ and -, and at most 32 characters. Use a new, empty repository where you can: the tool puts each file at the path Nexus has it, and a repository that allows overwrites replaces a file already there.
  • A repository token with Download and publish packages on those repositories.
  • Python 3.8 or later with pipx (or pip), on a machine that can reach your Nexus server and your CloudRepo organization over the network.
  • A Nexus login that can read the repositories, unless your Nexus allows anonymous reads.

cloudrepo-migrate is one command for Python 3.8 or later, with no dependencies. Install it from PyPI:

Terminal
pipx install cloudrepo-migrate

No pipx? pip install cloudrepo-migrate in a virtual environment works too. Then check that it runs:

Terminal
cloudrepo-migrate --version

nexus3 needs version 0.2.1 or later. If you installed the tool earlier for Nexus 2, run pipx upgrade cloudrepo-migrate. An older version answers invalid choice: 'nexus3'. PyPI repositories move from version 0.3.0. Earlier versions list them as skipped. Docker repositories move from version 0.6.0. Earlier versions list them as skipped. Raw repositories move from version 0.8.0, when --repo names them. Earlier versions list them as skipped.

Every version of each npm package moves from version 0.4.0. Versions before 0.4.0 move only the latest version of each npm package, so run pipx upgrade cloudrepo-migrate if yours is older than 0.4.0.

Put the credentials in the environment of the shell that runs the tool: NEXUS_USERNAME and NEXUS_PASSWORD for Nexus (leave both unset to read anonymously), and CLOUDREPO_TOKEN for CloudRepo. The tool reads them only from the environment, or asks for a missing one when it runs in a terminal. No option takes a credential, and the tool never prints one or writes one to the report.

The first command at the top of this page is the dry run. With CLOUDREPO_TOKEN set, it also checks the token and that each target repository exists. The second command is the real run.

Option Meaning
--nexus-url URL The base address of your Nexus 3 server, such as https://nexus.example.com. If Nexus is served under a path, include the path.
--org ORG or --cloudrepo-url URL Your CloudRepo organization, or its full https address.
--repo SOURCE or SOURCE=TARGET Move only this Nexus repository, to the CloudRepo repository TARGET (default: the same name). Repeat it for more. Default without it: every hosted Maven, npm, PyPI and Docker repository (Docker from version 0.6.0). A hosted raw repository moves only when named here, from version 0.8.0, into a CloudRepo Maven repository TARGET.
--dry-run List what would move. Upload nothing.
--quote From version 0.10.0. Count what you have, to ask us for a quote. It prints only totals for each format: the repositories, the items (Maven files, PyPI wheels and sdists, npm versions, Docker tags) and the bytes (npm bytes are not measured), and how many repositories could not be listed. It names nothing about your server, so you can send it to us as it is. It only reads Nexus: it implies --dry-run, needs no --org, and stops if CLOUDREPO_TOKEN is set.
--latest-only For npm, move only the version each package’s latest dist-tag names, as 0.2.0 did. Default without it: every version, with its dist-tags.
--report-json PATH Also write the report to PATH as JSON.
--json Print the report as one JSON document on standard output, and the text on standard error.
--jobs N Upload N Maven or PyPI files at a time (default 4). npm packages and Docker tags move one at a time.
--work-dir DIR Where a Maven or PyPI file, or a Docker layer, is held while it moves (default: the system temporary directory).
--nexus-ca-file PEM A CA bundle, for a Nexus with a private certificate.
In Nexus 3 What happens
Hosted repository, format maven2 Every file moves, POMs and checksum files included. The tool lists the files with Nexus’s assets API, so the maven-metadata.xml files, which belong to no component, move too. They move last, so a build never reads a version whose files have not landed.
Hosted repository, format npm Every version of each package moves, oldest first, scoped packages included. Then each dist-tag Nexus has (latest, next and any other) that CloudRepo lacks is added. A dist-tag CloudRepo already holds is never moved or removed: if it names another version than Nexus does, or Nexus has no such tag, the report lists it as kept. A deprecated version keeps its message. A version unpublished from Nexus is not in its package, so it does not move. With --latest-only, only the version latest names moves, as 0.2.0 did.
Hosted repository, format pypi Every wheel (.whl) and sdist (.tar.gz or .zip) moves, every version. Each is uploaded under the project name its own metadata gives, so pip finds it by the name it always had. Other files beside them, such as signatures, do not move, and the report counts them.
Hosted repository, format docker Every tag of every image moves, from version 0.6.0, with the manifest and every layer it names. A tag that lists several platforms moves with each platform’s image. Each image keeps its name and tags, and each manifest its digest. The report counts each tag as a file. See Docker images.
Hosted repository, format raw From version 0.8.0, moves only when --repo names it: every file it stores moves into TARGET, a CloudRepo Maven repository, at the same path and served as it is, a dot file and a root archetype-catalog.xml included. Without --repo naming it, it is skipped with a reason that names the flag. See Raw repositories.
Proxy repository Skipped. Create a proxy repository in CloudRepo if its upstream is one CloudRepo offers.
Group repository Skipped. Move the repositories it groups. For Maven, Docker, PyPI and npm (PyPI and npm in early access), you can then create a group repository in CloudRepo to serve them under one address.
Any other format Skipped. The tool moves Maven, npm, PyPI and, from version 0.6.0, Docker, and, from version 0.8.0, a raw repository --repo names. For the other formats CloudRepo hosts, export and import the files as Migrate from Sonatype Nexus Repository shows.
Files Nexus generates itself Skipped: any file or folder whose name starts with a dot, the root archetype-catalog.xml, and a PyPI repository’s simple/ index pages, which CloudRepo builds from the files. In a raw repository a dot file and a root archetype-catalog.xml move, as files someone stored.

Every skipped repository is in the report with its reason. The tool deletes nothing.

From version 0.6.0, a hosted Docker repository moves image by image: every tag, its manifest and every layer the manifest names. A tag that lists several platforms moves each platform’s image first, then the list. The tool reads Nexus through the Docker registry API Nexus serves at each repository’s address, with NEXUS_USERNAME and NEXUS_PASSWORD, whether Nexus asks for them directly (Force basic authentication) or through its Docker Bearer Token realm.

  • Every layer is checked against its digest. The bytes the tool reads from Nexus must hash to the digest the manifest names, and the layer is uploaded by that digest. A layer CloudRepo already holds is not uploaded again, and a layer several images share is uploaded once.
  • Every manifest is read back. Each manifest is uploaded as Nexus serves it, so it keeps its digest, then read back from CloudRepo and compared by digest.
  • A manifest that is not Docker schema 2 or OCI fails its tag. The tag is reported as failed, so the exit code is 1, with manifest REFERENCE is TYPE; CloudRepo takes Docker schema 2 and OCI manifests, where REFERENCE is the tag or digest it read and TYPE is the media type Nexus served, or untyped.
  • A layer over 2 GiB fails its tag. The tag is reported as failed, so the exit code is 1, with blob DIGEST is SIZE bytes; CloudRepo takes a blob of at most 2147483648.
  • Proxy and group repositories are skipped, with the reason. A Docker proxy repository is skipped as proxy of its remote: create a proxy repository in CloudRepo instead. A Docker group repository is skipped as a group repository: move the repositories it groups.
  • CLOUDREPO_TOKEN must be a CloudRepo repository token. Create a repository token with Download and publish packages on the target Docker repository. The tool signs in to CloudRepo’s Docker registry with it, so there is no username to set.

Create a Docker repository in CloudRepo for each Nexus Docker repository you move. In the commands below, replace docker-hosted with the name of your Nexus Docker repository, or write docker-hosted=TARGET to move it into a CloudRepo repository named TARGET. A dry run counts the tags and bytes and uploads nothing:

Terminal
cloudrepo-migrate nexus3 \
--nexus-url https://nexus.example.com \
--org your-org \
--repo docker-hosted \
--dry-run

When the list looks right, run it for real:

Terminal
cloudrepo-migrate nexus3 \
--nexus-url https://nexus.example.com \
--org your-org \
--repo docker-hosted \
--report-json report.json

Run the second command again to resume: a tag CloudRepo already holds at the same digest is counted as already present, and nothing of it is uploaded. After the move, Docker clients pull each image from CloudRepo with repositories/<repository>/ in its name, as Pull Docker images shows.

From version 0.8.0, a hosted raw repository moves when you name it with --repo, into a CloudRepo Maven repository. CloudRepo has no raw repository type: a Maven repository serves any file at any path, so installers, archives and other binaries keep the paths your scripts already fetch. Tested against a real Nexus 3 (sonatype/nexus3:3.76.0). On Artifactory, a Generic repository moves the same way: see Generic repositories.

  • Every file, at the same path. Every file the raw repository stores moves into the CloudRepo Maven repository at the path Nexus has it, and CloudRepo serves it as it is, so only the address before the path changes. A file or folder whose name starts with a dot, and a root archetype-catalog.xml, move too: in a raw repository each is a file someone stored.
  • Every file is checked against the checksum Nexus recorded. Before the upload, the bytes must match each checksum Nexus lists for the file, and Nexus must have recorded its SHA-1 or SHA-256: a file with neither is not uploaded. After the upload, the tool reads the file back from CloudRepo and compares its SHA-1 and SHA-256.
  • No checksum file is added. The tool writes no .sha1 or .md5 beside a raw file: those are a Maven client’s, and only what Nexus stores moves. A checksum file Nexus stores moves as a file, and must name the digest of the file beside it.
  • A file CloudRepo cannot store fails, in a dry run too. A path with a character outside A-Z a-z 0-9 + _ - . ! * ' ( ) / @ ~, longer than 1024 characters, or with an empty, . or .. segment, and a file over 50,000,000,000 bytes, the most CloudRepo stores in one file, are each listed as a failure with the path, so the exit code is 1. A --dry-run lists the same failures, before anything moves.
  • Unnamed, it is skipped, with the flag to use. Without --repo naming it, a raw repository is skipped as raw format is not supported by default: name it with --repo NAME=TARGET to move its files into a CloudRepo Maven repository TARGET, each at the same path.
  • --repo moves only what it names. Name your other repositories beside the raw one, or move the raw one in a run of its own.

Create a Maven repository in CloudRepo for each Nexus raw repository you move. In the commands below, replace raw-hosted with the name of your Nexus raw repository, and installers with the CloudRepo Maven repository it moves into. A dry run counts the files and bytes, lists each file CloudRepo cannot store, and uploads nothing:

Terminal
cloudrepo-migrate nexus3 \
--nexus-url https://nexus.example.com \
--org your-org \
--repo raw-hosted=installers \
--dry-run

When the list looks right, run it for real:

Terminal
cloudrepo-migrate nexus3 \
--nexus-url https://nexus.example.com \
--org your-org \
--repo raw-hosted=installers \
--report-json report.json

Run the second command again to resume: a file CloudRepo already holds with the same bytes is counted as already present. After the move, fetch each file from CloudRepo at its same path, as Raw files over HTTP shows.

  1. Before the upload. A Maven file’s, wheel’s or sdist’s bytes must match each checksum Nexus lists for it (SHA-1, SHA-256, SHA-512 or MD5). An npm tarball must match its package’s dist.shasum and, when the package has one, its dist.integrity. A file that does not match is not uploaded.
  2. After the upload. The tool reads the file back from CloudRepo and compares its SHA-1 and SHA-256 with the bytes it took from Nexus. A wheel or sdist must also be listed in its project’s index, where pip looks for it.
  3. Checksum files. A checksum file Nexus holds (.sha1, .sha256, .sha512 or .md5) must name the digest of the file it sits beside.
  4. Docker. Each layer must hash to the digest its manifest names before it is uploaded, and each manifest is read back from CloudRepo and compared by digest, as Docker images says.
  5. Raw. A raw file is checked as a Maven file is, and Nexus must have recorded its SHA-1 or SHA-256, or it is not uploaded, as Raw repositories says.

Any mismatch fails the run and names the file. The run then exits with 1, so a script or an agent cannot read a failed check as success.

Run the same command again. A Maven, raw, npm or PyPI file CloudRepo already holds is counted as already present, and not uploaded again, only after the tool has read it back and found the same bytes. A repository that refuses to overwrite a release answers 409 for a file it holds. The tool counts that file as moved only when the bytes CloudRepo holds match the source. A Docker tag CloudRepo already holds at the same digest is counted as already present on that one digest check, with nothing read back.

The last line of the output is the result:

Moved N repositories, F files, B bytes in M minutes; V of F verified, K failed.

N, F and B are the repositories, files and bytes that moved, M is the elapsed time, V is the number of Maven, npm and PyPI files read back and matching plus the number of Docker tags verified, and K is the number that failed. A Docker tag is verified when its manifest’s digest matches and its blobs were checked by digest before upload, or when CloudRepo already held it at the same digest; layers are not read back. Above it is one line for each repository: its Nexus name, its CloudRepo name, its format, its counts and, for a skipped repository, why. A line REPO PACKAGE: kept: TAG -> VERSION (source: VERSION or none) names an npm dist-tag CloudRepo already holds that the tool left as it was. It is not a failure.

--report-json writes the same report as JSON, and --json prints it as one JSON document on standard output (the text then goes to standard error). A script reads these keys:

Key Holds
exit_code The exit code of the run, as in If something fails.
error The message of a run that stopped before its report, such as a refused token. Such a document holds only exit_code and error.
totals.files, .verified, .failed The counts in the last line.
failures One entry for each failed file, with its repository, path and reason. Empty when nothing failed.
kept One entry for each npm dist-tag CloudRepo already holds and the tool left as it was: its repository, path (the package), tag, version (CloudRepo’s) and source (the version Nexus tags, or null when Nexus has no such tag). Not a failure.
repositories[].action moved, would move (a dry run), skipped, ready or blocked.
repositories[].reason Why a repository was skipped or blocked, the count of other PyPI files that did not move, how many Docker images a repository holds, or, in a dry run, what moves from an npm repository.

The exit code says which kind of failure it was:

Exit code Meaning
0 Everything moved, every Maven, npm and PyPI file was read back and matched, and every Docker tag’s manifest matched its digest.
1 At least one file failed. The output lists each one with its path. Fix the cause and run the same command again.
2 A problem before anything moved, such as a missing target repository or a refused token. Nothing was uploaded.
130 Stopped with Ctrl-C. Run the same command again to resume.

The messages you are most likely to see:

The output says What to do
CloudRepo has no repository NAME: create it as ... Create the repository in CloudRepo, in the format named, then run again. Or map the Nexus repository to another with --repo.
CloudRepo has no Docker repository NAME: create one at ... Create a Docker repository with that name in CloudRepo, then run again. Or map the Nexus repository to another with --repo.
... is not a valid CloudRepo repository name The Nexus name is not a valid CloudRepo name. Choose a name with --repo SOURCE=TARGET.
CloudRepo refused the token Check CLOUDREPO_TOKEN, and that the token belongs to this organization.
the token cannot reach CloudRepo repository NAME, or cannot publish Give the token Download and publish packages on that repository.
Nexus refused the login Set NEXUS_USERNAME and NEXUS_PASSWORD to a login that can read the repository.
the bytes Nexus served ... do not match the ... Nexus recorded The copy in Nexus does not match its own record, so the tool did not upload it. Check that file in Nexus.
Nexus recorded no sha1 or sha256 for the file, so it cannot be checked before the upload A raw file Nexus holds no SHA-1 or SHA-256 for, so the tool did not upload it. Check that file in Nexus.
CloudRepo cannot store this path (...) The path has a character outside the ones the message lists, is longer than 1024 characters, or has an empty, . or .. segment, so the file does not move. The other files do. Rename it in Nexus to move it; until then the run keeps exiting 1.
the file is SIZE bytes, over the 50000000000 bytes CloudRepo stores in one file The file is larger than CloudRepo stores in one file, so it does not move. The other files do, and the run keeps exiting 1 while the file is in the repository you move.
dist-tags the source has, not added: ... A dist-tag Nexus has, and CloudRepo lacks, names a version that did not move, whose own failure is listed too: fix that one and run the same command again. A tag that names a version Nexus does not list stays unset until you retag it in Nexus.
CloudRepo already holds different bytes for this path and refuses overwrites The file in CloudRepo is not the one in Nexus, and the repository will not replace it. Decide which copy is right, then email support@cloudrepo.io with the path.
its sha1 checksum file ... says ... The checksum file in Nexus disagrees with its file. The bytes moved unchanged. Only fixing the file in Nexus clears this, and the run keeps exiting 1 until you do.
the bytes CloudRepo serves back differ from the source Run the same command again. If the same file fails twice, email support@cloudrepo.io with its path.
... project index does not list the file, so pip would not find it Run the same command again. If the same file fails twice, email support@cloudrepo.io with its path.

The files are in CloudRepo: every Maven file, every file of each raw repository you named, every wheel and sdist of a PyPI repository, and every npm version with its dist-tags, so a build that pins an older npm version resolves it from CloudRepo too. The PyPI files beside a wheel or sdist do not move, and the report counts them. Your builds still point at Nexus. Repoint them one project at a time, as step 5 of Migrate from Sonatype Nexus Repository shows for each build tool, and leave Nexus running until your builds pass against CloudRepo.

A lockfile holds URLs too. Change every Nexus and Artifactory URL in your builds, lockfiles included maps each Nexus URL to its CloudRepo URL, finds every one in your repositories and regenerates package-lock.json, yarn.lock, poetry.lock and uv.lock.

Give your agent this instruction. It carries the address of this page as plain text, so the agent reads this page and nothing else:

Migrate my Nexus 3 to CloudRepo. Follow https://www.cloudrepo.io/docs/migrate/from-nexus-3.md. Read my credentials from the environment variables NEXUS_USERNAME, NEXUS_PASSWORD and CLOUDREPO_TOKEN, and ask me for the Nexus URL and the CloudRepo organization if you do not have them.

The invocation, in two runs. Replace the address and the organization with the owner’s:

Terminal
cloudrepo-migrate nexus3 --nexus-url https://nexus.example.com --org your-org --dry-run --json
cloudrepo-migrate nexus3 --nexus-url https://nexus.example.com --org your-org --json

Each run prints one JSON document on standard output, its result, and the text report on standard error. The end report names the keys.

Steps:

  1. Check that python3 --version is 3.8 or later. If cloudrepo-migrate --version does not answer, install the tool with the command in Install the tool, and check again. If it answers a version older than 0.6.0, run pipx upgrade cloudrepo-migrate, and check again. Docker needs 0.6.0. If cloudrepo-migrate nexus3 --help does not list --json, run pipx upgrade cloudrepo-migrate. If it still does not, run each command with --report-json report.json in place of --json, and read report.json: the same document, without exit_code.
  2. Check that CLOUDREPO_TOKEN is set without printing it, for example with test -n "$CLOUDREPO_TOKEN". Do the same for NEXUS_USERNAME and NEXUS_PASSWORD, unless the owner says Nexus allows anonymous reads.
  3. Run the first command, the dry run. It reads Nexus and writes nothing to CloudRepo. Expect exit code 0, and in the document exit_code 0 and dry_run true. Each entry in repositories with the action would move is a repository that will move, with its format and files; each with the action skipped says why in its reason. On exit code 2, read error, or the reason of each repository with the action blocked, in If something fails. If a target repository is missing, ask the owner to create it in the portal, then repeat the dry run.
  4. Run the second command.
  5. Verify, all of these, in the document it printed:
    • exit_code is 0, and so is the exit code of the command.
    • failures is empty, totals.failed is 0 and totals.verified equals totals.files.
    • No entry in repositories has the action blocked.
  6. Tell the owner totals.repositories, totals.files and totals.verified, every repository with the action skipped and its reason, every entry in kept (a dist-tag CloudRepo already holds, left as it was), from a version older than 0.4.0 or with --latest-only, every npm repository whose reason counts versions that did not move, and every PyPI repository whose reason counts other files that did not move.

If the exit code is 1, read each entry in failures, with its path and reason, remove its cause, and run the second command again, which resumes. If the same file fails twice, stop and report its path and reason to the owner.

Do not put a credential on a command line, in a file or in your answer. Do not change anything in Nexus. Do not repoint builds or switch CI to CloudRepo until the owner tells you to.

View as Markdown