-
-
Save on195594/6a5c0ba20fbb3ddc17b82df7d7c268b4 to your computer and use it in GitHub Desktop.
Bulk upload your local maven repository to your private Nexus repository
This file contains hidden or 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
#!/bin/sh | |
# Reference: http://roboojack.blogspot.in/2014/12/bulk-upload-your-local-maven-artifacts.html | |
if [ "$#" -ne 3 ] || ! [ -d "$1" ]; then | |
echo "Usage:" | |
echo " bash run.sh <repoRootFolder> <repositoryId> <repositoryUrl>" | |
echo "" | |
echo "" | |
echo " Where..." | |
echo " repoRootFolder: The folder containing the repository tree." | |
echo " Ensure you move the repository outside of ~/.m2 folder" | |
echo " or whatever is configured in settings.xml" | |
echo " repositoryId: The repositoryId from the <server> configured for the repositoryUrl in settings.xml." | |
echo " Ensure that you have configured username and password in settings.xml." | |
echo " repositoryUrl: The URL of the repository where you want to upload the files." | |
exit 1 | |
fi | |
while read -r line ; do | |
echo "Processing file $line" | |
pomLocation=${line/./} | |
pomLocation=$PWD${pomLocation/jar/pom} | |
jarLocation=${line/./} | |
jarLocation=$PWD${jarLocation/pom/jar} | |
#echo $pomLocation | |
#echo $jarLocation | |
mvn deploy:deploy-file -DpomFile=$pomLocation -Dfile=$jarLocation -DrepositoryId=$2 -Durl=$3 | |
done < <(find $1 -name "*.jar") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment