banner
keney

keney

remain optimistic
twitter

Batch upload local dependencies to Maven private repository

Uploading Local Repository Dependencies to Remote Repository#

Uploading local repository to remote repository

Batch upload:

Batch local repository dependencies (jar files) upload script:

#!/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 -u "$USERNAME:$PASSWORD" -X PUT -v -T {} ${REPO_URL}/{} ;

Create a batch_upload_repo2.sh script in the maven local repository directory and add the above content to the script file.

In the maven local repository directory, right-click to open the git-bash Here command window:

Execute the following command:

sh batch_upload_repo2.sh -u admin -p nxg_123456 -r http://localhost:8081/repository/nxgtest/

sh script_name.sh -u username -p password -r http://localhost:8081/repository/repository_name

The result after execution is shown in the image below:

Notes#

Delete all .lastUpdated files in the local maven repository directory.

If the upload fails, you can delete all _remote.repositories files in the local maven repository directory.

References#

References:
Batch Upload All Jars from Local Repository to Nexus

Batch Upload Dependencies to Nexus Intranet Private Repository Based on Automation Script

Batch Upload Local Maven Repository to Nexus Server

Using Offline Repository for Maven Intranet Development

Continuous Integration Working Principle - Maven Private Repository

Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.