The aims of the n3dr tool are:
- to backup all artifacts from a certain Nexus maven repository.
- to migrate all artifacts from NexusA to NexusB.
The tests start a nexus docker container. The tests will be started once the docker container is running and fake artifacts have been uploaded. Finally, all submitted artifacts will be downloaded.
One could use this docker-compose.yml and start a backup of all repositories, after modifying it, and issue:
docker-compose up
Define the password in ~/.n3dr.yaml
:
---
n3drPass: admin123
and set the permissions to 400 by issuing:
chmod 400 ~/.n3dr.yaml
In order to read the help menu, one has to run:
./n3dr
The output will look as follows:
N3DR is a tool that is able to download all artifacts from
a certain Nexus3 repository.
Usage:
n3dr [command]
Available Commands:
backup Backup all artifacts from a Nexus3 repository
help Help about any command
repositories Count the number of repositories or return their names
Flags:
-h, --help help for n3dr
Use "n3dr [command] --help" for more information about a command.
The backup command will backup all artifacts that reside in a Nexus maven repository.
[user@localhost n3dr]$ ./n3dr backup -h
Use this command in order to backup all artifacts that
reside in a certain Nexus3 repository
Usage:
n3dr backup [flags]
Flags:
-h, --help help for backup
-p, --n3drPass string The Nexus3 password (default "admin123")
-r, --n3drRepo string The Nexus3 repository (default "maven-releases")
-n, --n3drURL string The Nexus3 URL (default "http://localhost:8081")
-u, --n3drUser string The Nexus3 user (default "admin")
In order to get an overview of all repositories that are available in a certain Nexus3 instance, one could use the following commands:
Count the number of repositories or
count the total
Usage:
n3dr repositories [flags]
Flags:
-c, --count Count the number of repositories
-h, --help help for repositories
-n, --names Print all repository names
go run main.go repositories --download --n3drURL http://localhost:9999
docker run --rm -e HTTPS_PROXY=some-proxy \
-v ~/.n3dr.yaml:/home/n3dr/.n3dr.yaml \
-v ${PWD}/nexus3backup:/download utrecht/n3dr:3.0.0 \
backup -p pass -r maven-releases \
-n https://some-nexus-repo -u admin
There is a number of equivalent tools:
- https://github.com/RiotGamesMinions/nexus_cli
- https://github.com/packagemgmt/repositorytools
- https://github.com/thiagofigueiro/nexus3-cli
The difference is that n3dr is able to download artifacts from all Nexus3 repositories.