Created
July 31, 2018 12:46
-
-
Save DennisRippinger/1090e64f8e7a37887b7eeadc6aa5c6dc to your computer and use it in GitHub Desktop.
Upload entire local Maven Repo to Nexus
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
REPO_LOCATION=~/.m2/repository/ | |
find ${REPO_LOCATION} -type f \ | |
-not -name "*repositories" \ | |
-and -not -name '*.lastUpdated' \ | |
-and -not -directory '*.cache*' \ | |
-and -not -directory '*.meta*' | \ | |
while read path; do | |
# Adapt cut length acordingly | |
gavName=$(echo $path | cut -c 34-) | |
# Adapt Path and Credentials accordingly | |
curl -v -u admin:admin123 --upload-file ${path} http:/localhost:8081/repository/central/${gavName} | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Sometimes a customer has strong/strange security constraints and wants to use maven, but do not allow the nexus host to access the internet or central. With this we can upload a local repo to nexus.