Skip to content

Instantly share code, notes, and snippets.

@DennisRippinger
Created July 31, 2018 12:46
Show Gist options
  • Save DennisRippinger/1090e64f8e7a37887b7eeadc6aa5c6dc to your computer and use it in GitHub Desktop.
Save DennisRippinger/1090e64f8e7a37887b7eeadc6aa5c6dc to your computer and use it in GitHub Desktop.
Upload entire local Maven Repo to Nexus
#!/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
@DennisRippinger
Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment