Accueil · Bloc-notes · Catégories · À propos

Comment exporter et importer des repositories maven depuis nexus

02/06/2023 · 124 mots · 1 min. ·

Export

git clone https://github.com/LoadingByte/nexus3-exporter
cd nexus3-exporter
python3 nexus3_exporter.py -u admin123 -o repo https://maven.pwu.fr maven-public

Import

https://github.com/sonatype-nexus-community/nexus-repository-import-scripts

#!/bin/bash

# copy and run this script to the root of the repository directory containing files
# this script attempts to exclude uploading itself explicitly so the script name is important
# Get command line params
while getopts ":r:u:p:" opt; do
        case $opt in
                r) REPO_URL="$OPTARG"
                ;;
                u) USERNAME="$OPTARG"
                ;;
                p) PASSWORD="$OPTARG"
                ;;
        esac
done

find . -type f -not -path './mavenimport\.sh*' -not -path '*/\.*' -not -path '*/\^archetype\-catalog\.xml*' -not -path '*/\^maven\-metadata\-local*\.xml' -not -path '*/\^maven\-metadata\-deployment*\.xml' | sed "s|^\./||" | xargs -I '{}' curl -H 'authorization: Basic xxx' -X PUT --upload-file {} ${REPO_URL}/{} ;