Command-line Interface

Before using the CLI, you need to run nexus3 login to create the client configuration.

Environment Variables

The configuration configuration can be set via environment variables, which take precedence over configuration saved on file:

  • NEXUS3_PASSWORD (required)

  • NEXUS3_USERNAME (required)

  • NEXUS3_URL (required)

  • NEXUS3_API_VERSION (optional)

  • NEXUS3_X509_VERIFY (optional)

The client logging level can be configured by setting an environment variable named LOG_LEVEL. Valid values are: DEBUG, INFO, WARNING (default), ERROR, CRITICAL.

Commands

After installing the nexus3-cli python package, the nexus3 executable will be available on your command line. It accepts several different commands.

nexus3

nexus3 [OPTIONS] COMMAND [ARGS]...

Options

--version

Show the version and exit.

blobstore

Blob store operations.

nexus3 blobstore [OPTIONS] COMMAND [ARGS]...
create

Create a new Blobstore.

nexus3 blobstore create [OPTIONS] COMMAND [ARGS]...
file

Create NAME blob store of type File stored at PATH.

nexus3 blobstore create file [OPTIONS] NAME PATH

Options

-q, --quota-type <quota_type>

Enable soft quota of the chosen type

Options

spaceRemainingQuota|spaceUsedQuota

-l, --quota-limit <quota_limit>

Quota limit in bytes

Arguments

NAME

Required argument

PATH

Required argument

s3

Create NAME blob store of type S3.

nexus3 blobstore create s3 [OPTIONS] NAME

Options

-r, --bucket-region <bucket_region>

AWS region [required]

-n, --bucket-name <bucket_name>

S3 bucket name [required]

-k, --key-id <key_id>

IAM access key ID [required]

-s, --secret-key <secret_key>

Secret for key ID [required]

--bucket-prefix <bucket_prefix>
--bucket-expiration <bucket_expiration>

Days until deleted blobs are removed

-e, --encryption-type <encryption_type>

S3 encryption

Options

s3ManagedEncryption|kmsManagedEncryption

-E, --encryption-key <encryption_key>
--role <role>

IAM role to assume

--session-token <session_token>

AWS STS session token for temporary credentials

-q, --quota-type <quota_type>

Enable soft quota of the chosen type

Options

spaceRemainingQuota|spaceUsedQuota

-l, --quota-limit <quota_limit>

Quota limit in bytes

Arguments

NAME

Required argument

delete

Delete blob store NAME

nexus3 blobstore delete [OPTIONS] NAME

Options

--yes

Confirm the action without prompting.

Arguments

NAME

Required argument

list

List all blob stores.

nexus3 blobstore list [OPTIONS]

Options

--json, --no-json

Print output as json

show

Show the details for NAME as JSON.

nexus3 blobstore show [OPTIONS] NAME

Arguments

NAME

Required argument

cleanup-policy

Manage clean-up policies.

nexus3 cleanup-policy [OPTIONS] COMMAND [ARGS]...
create

Create or update a cleanup policy called NAME.

nexus3 cleanup-policy create [OPTIONS] NAME

Options

--format <format>

The recipe that this cleanup policy can be applied to

Options

all|apt|bower|docker|maven|npm|nuget|pypi|raw|rubygems|yum

--downloaded <downloaded>

Cleanup criteria; last downloaded in this many days.

--updated <updated>

Cleanup criteria; last updated in this many days.

--regex <regex>

Cleanup criteria; only cleanup components matching expression

--notes <notes>

Notes about your policy

Arguments

NAME

Required argument

list
nexus3 cleanup-policy list [OPTIONS]
show

Show the details for POLICY_NAME as JSON.

nexus3 cleanup-policy show [OPTIONS] POLICY_NAME

Arguments

POLICY_NAME

Required argument

delete

Recursively delete all files under REPOSITORY_PATH.

REPOSITORY_PATH must start with a repository name.

nexus3 delete [OPTIONS] REPOSITORY_PATH

Arguments

REPOSITORY_PATH

Required argument

download

Download remote SRC to local DEST. If either argument ends with a /, it’s assumed to be a directory.

SRC must start with a repository name and optionally be followed by a path to be downloaded.

nexus3 download [OPTIONS] SRC DST

Options

--flatten, --no-flatten

Flatten DEST directory structure

--cache, --no-cache

Do not download if a local copy is already up-to-date

Arguments

SRC

Required argument

DST

Required argument

list

List all files within REPOSITORY_PATH.

REPOSITORY_PATH must start with a repository name.

nexus3 list [OPTIONS] REPOSITORY_PATH

Arguments

REPOSITORY_PATH

Required argument

login

Login to Nexus server, saving settings to ~/.nexus-cli. and ~/.nexus-cli.env.

nexus3 login [OPTIONS]

Options

-U, --url <url>

Nexus OSS URL [default: http://localhost:8081]

-u, --username <username>

Nexus user [default: admin]

-p, --password <password>

Password for user

--x509_verify, --no-x509_verify

Verify server certificate [default: True]

repository

Manage repositories.

nexus3 repository [OPTIONS] COMMAND [ARGS]...
create

Create a repository.

nexus3 repository create [OPTIONS] COMMAND [ARGS]...
group

Create a group repository.

nexus3 repository create group [OPTIONS] COMMAND [ARGS]...
recipe

Create group repository NAME.

nexus3 repository create group recipe [OPTIONS] NAME

Options

--blob-store-name <blob_store_name>

Blobstore name to use with new repository

--strict-content, --no-strict-content

Toggle strict content type validation

-m, --member-names <member_names>

Repository name(s) to add to group

Arguments

NAME

Required argument

hosted

Create a hosted repository.

nexus3 repository create hosted [OPTIONS] COMMAND [ARGS]...
apt

Create a hosted apt repository.

nexus3 repository create hosted apt [OPTIONS] NAME

Options

--blob-store-name <blob_store_name>

Blobstore name to use with new repository

--strict-content, --no-strict-content

Toggle strict content type validation

--cleanup-policy <cleanup_policy>

Name of existing clean-up policy to use

--write-policy <write_policy>

Write policy to use

Options

allow|allow_once|deny

--distribution <distribution>

Distribution to fetch; e.g.: bionic [required]

--gpg-keypair <gpg_keypair>

Path to GPG signing key [required]

--passphrase <passphrase>

Passphrase for GPG key pair

Arguments

NAME

Required argument

docker

Create a hosted docker repository.

nexus3 repository create hosted docker [OPTIONS] NAME

Options

--blob-store-name <blob_store_name>

Blobstore name to use with new repository

--strict-content, --no-strict-content

Toggle strict content type validation

--cleanup-policy <cleanup_policy>

Name of existing clean-up policy to use

--write-policy <write_policy>

Write policy to use

Options

allow|allow_once|deny

--v1-enabled, --no-v1-enabled

Enable v1 registry

--force-basic-auth, --no-force-basic-auth

Force use of basic authentication

--http-port <http_port>

Port for HTTP service

--https-port <https_port>

Port for HTTPS service

Arguments

NAME

Required argument

maven

Create a hosted maven repository.

nexus3 repository create hosted maven [OPTIONS] NAME

Options

--blob-store-name <blob_store_name>

Blobstore name to use with new repository

--strict-content, --no-strict-content

Toggle strict content type validation

--cleanup-policy <cleanup_policy>

Name of existing clean-up policy to use

--write-policy <write_policy>

Write policy to use

Options

allow|allow_once|deny

--version-policy <version_policy>

Version policy to use

Options

release|snapshot|mixed

--layout-policy <layout_policy>

Layout policy to use

Options

strict|permissive

Arguments

NAME

Required argument

recipe

Create a hosted repository NAME of given recipe.

nexus3 repository create hosted recipe [OPTIONS] NAME

Options

--blob-store-name <blob_store_name>

Blobstore name to use with new repository

--strict-content, --no-strict-content

Toggle strict content type validation

--cleanup-policy <cleanup_policy>

Name of existing clean-up policy to use

--write-policy <write_policy>

Write policy to use

Options

allow|allow_once|deny

Arguments

NAME

Required argument

yum

Create a hosted yum repository.

nexus3 repository create hosted yum [OPTIONS] NAME

Options

--blob-store-name <blob_store_name>

Blobstore name to use with new repository

--strict-content, --no-strict-content

Toggle strict content type validation

--cleanup-policy <cleanup_policy>

Name of existing clean-up policy to use

--write-policy <write_policy>

Write policy to use

Options

allow|allow_once|deny

--depth <depth>

Depth where repodata folder(s) exist

Arguments

NAME

Required argument

proxy

Create proxy repository NAME.

nexus3 repository create proxy [OPTIONS] COMMAND [ARGS]...
apt

Create a proxy apt repository.

nexus3 repository create proxy apt [OPTIONS] NAME REMOTE_URL

Options

--blob-store-name <blob_store_name>

Blobstore name to use with new repository

--strict-content, --no-strict-content

Toggle strict content type validation

--cleanup-policy <cleanup_policy>

Name of existing clean-up policy to use

--auto-block, --no-auto-block

Disable outbound connections on remote-url access errors

--negative-cache, --no-negative-cache

Cache responses for content missing in the remote-url

--negative-cache-ttl <negative_cache_ttl>

Cache time in minutes

--content-max-age <content_max_age>

Maximum age of cached artefacts

--metadata-max-age <metadata_max_age>

Maximum age of cached artefacts metadata

--remote-auth-type <remote_auth_type>

Only username is supported

Options

username

--health-check, --no-health-check

Enable Repository Health Check

--remote-username <remote_username>

Username for remote URL

--remote-password <remote_password>

Password for remote URL

--distribution <distribution>

Distribution to fetch; e.g.: bionic [required]

--flat, --no-flat

Is this repository flat?

Arguments

NAME

Required argument

REMOTE_URL

Required argument

docker

Create a docker proxy repository.

nexus3 repository create proxy docker [OPTIONS] NAME REMOTE_URL

Options

--blob-store-name <blob_store_name>

Blobstore name to use with new repository

--strict-content, --no-strict-content

Toggle strict content type validation

--cleanup-policy <cleanup_policy>

Name of existing clean-up policy to use

--auto-block, --no-auto-block

Disable outbound connections on remote-url access errors

--negative-cache, --no-negative-cache

Cache responses for content missing in the remote-url

--negative-cache-ttl <negative_cache_ttl>

Cache time in minutes

--content-max-age <content_max_age>

Maximum age of cached artefacts

--metadata-max-age <metadata_max_age>

Maximum age of cached artefacts metadata

--remote-auth-type <remote_auth_type>

Only username is supported

Options

username

--health-check, --no-health-check

Enable Repository Health Check

--remote-username <remote_username>

Username for remote URL

--remote-password <remote_password>

Password for remote URL

--v1-enabled, --no-v1-enabled

Enable v1 registry

--force-basic-auth, --no-force-basic-auth

Force use of basic authentication

--http-port <http_port>

Port for HTTP service

--https-port <https_port>

Port for HTTPS service

--index-type <index_type>

Docker index type

Options

registry|hub|custom

--index-url <index_url>

Required for –index-type custom

--trust-store, --no-trust-store

Required for –index-type hub or custom

Arguments

NAME

Required argument

REMOTE_URL

Required argument

maven

Create a maven proxy repository.

nexus3 repository create proxy maven [OPTIONS] NAME REMOTE_URL

Options

--blob-store-name <blob_store_name>

Blobstore name to use with new repository

--strict-content, --no-strict-content

Toggle strict content type validation

--cleanup-policy <cleanup_policy>

Name of existing clean-up policy to use

--auto-block, --no-auto-block

Disable outbound connections on remote-url access errors

--negative-cache, --no-negative-cache

Cache responses for content missing in the remote-url

--negative-cache-ttl <negative_cache_ttl>

Cache time in minutes

--content-max-age <content_max_age>

Maximum age of cached artefacts

--metadata-max-age <metadata_max_age>

Maximum age of cached artefacts metadata

--remote-auth-type <remote_auth_type>

Only username is supported

Options

username

--health-check, --no-health-check

Enable Repository Health Check

--remote-username <remote_username>

Username for remote URL

--remote-password <remote_password>

Password for remote URL

--version-policy <version_policy>

Version policy to use

Options

release|snapshot|mixed

--layout-policy <layout_policy>

Layout policy to use

Options

strict|permissive

Arguments

NAME

Required argument

REMOTE_URL

Required argument

recipe

Create a proxy repository.

nexus3 repository create proxy recipe [OPTIONS] NAME REMOTE_URL

Options

--blob-store-name <blob_store_name>

Blobstore name to use with new repository

--strict-content, --no-strict-content

Toggle strict content type validation

--cleanup-policy <cleanup_policy>

Name of existing clean-up policy to use

--auto-block, --no-auto-block

Disable outbound connections on remote-url access errors

--negative-cache, --no-negative-cache

Cache responses for content missing in the remote-url

--negative-cache-ttl <negative_cache_ttl>

Cache time in minutes

--content-max-age <content_max_age>

Maximum age of cached artefacts

--metadata-max-age <metadata_max_age>

Maximum age of cached artefacts metadata

--remote-auth-type <remote_auth_type>

Only username is supported

Options

username

--health-check, --no-health-check

Enable Repository Health Check

--remote-username <remote_username>

Username for remote URL

--remote-password <remote_password>

Password for remote URL

Arguments

NAME

Required argument

REMOTE_URL

Required argument

yum

Create a yum proxy repository.

nexus3 repository create proxy yum [OPTIONS] NAME REMOTE_URL

Options

--blob-store-name <blob_store_name>

Blobstore name to use with new repository

--strict-content, --no-strict-content

Toggle strict content type validation

--cleanup-policy <cleanup_policy>

Name of existing clean-up policy to use

--auto-block, --no-auto-block

Disable outbound connections on remote-url access errors

--negative-cache, --no-negative-cache

Cache responses for content missing in the remote-url

--negative-cache-ttl <negative_cache_ttl>

Cache time in minutes

--content-max-age <content_max_age>

Maximum age of cached artefacts

--metadata-max-age <metadata_max_age>

Maximum age of cached artefacts metadata

--remote-auth-type <remote_auth_type>

Only username is supported

Options

username

--health-check, --no-health-check

Enable Repository Health Check

--remote-username <remote_username>

Username for remote URL

--remote-password <remote_password>

Password for remote URL

Arguments

NAME

Required argument

REMOTE_URL

Required argument

delete

Delete REPOSITORY_NAME (but not its blobstore).

nexus3 repository delete [OPTIONS] REPOSITORY_NAME

Options

--yes

Confirm the action without prompting.

Arguments

REPOSITORY_NAME

Required argument

list

List all repositories.

nexus3 repository list [OPTIONS]
show

Show the configuration for REPOSITORY_NAME as JSON.

nexus3 repository show [OPTIONS] REPOSITORY_NAME

Arguments

REPOSITORY_NAME

Required argument

script

Manage scripts.

nexus3 script [OPTIONS] COMMAND [ARGS]...
create

Create a new script called NAME from FILE.

nexus3 script create [OPTIONS] NAME FILE

Options

--script-type <script_type>

Script type

Arguments

NAME

Required argument

FILE

Required argument

delete

Delete the script called NAME.

nexus3 script delete [OPTIONS] NAME

Arguments

NAME

Required argument

list

List all scripts.

nexus3 script list [OPTIONS]
run

Run the script called NAME.

nexus3 script run [OPTIONS] NAME

Options

-a, --script-arguments <script_arguments>

Arguments

NAME

Required argument

security

Security operations.

nexus3 security [OPTIONS] COMMAND [ARGS]...
realm

Security realms operations.

nexus3 security realm [OPTIONS] COMMAND [ARGS]...
activate

Activate REALM_ID

nexus3 security realm activate [OPTIONS] REALM_ID

Arguments

REALM_ID

Required argument

active

List active security realms as a JSON list.

nexus3 security realm active [OPTIONS]
available

List available security realms.

nexus3 security realm available [OPTIONS]

Options

--json, --no-json

Print output as json

task

Task operations.

nexus3 task [OPTIONS] COMMAND [ARGS]...
list

List all tasks.

nexus3 task list [OPTIONS]

Options

--json, --no-json

Print output as json

run

Run TASK_ID.

nexus3 task run [OPTIONS] TASK_ID

Arguments

TASK_ID

Required argument

show

Show the details for TASK_ID as JSON.

nexus3 task show [OPTIONS] TASK_ID

Arguments

TASK_ID

Required argument

stop

Stop running TASK_ID.

nexus3 task stop [OPTIONS] TASK_ID

Arguments

TASK_ID

Required argument

upload

Upload local SRC to remote DST. If either argument ends with a /, it’s assumed to be a directory.

DEST must start with a repository name and optionally be followed by the path where SRC is to be uploaded to.

nexus3 upload [OPTIONS] SRC DST

Options

--flatten, --no-flatten

Flatten DST directory structure

--recurse, --no-recurse

Process all SRC subdirectories

Arguments

SRC

Required argument

DST

Required argument