Last active
October 11, 2023 09:32
-
-
Save SanSan-/3acc532687df60cfcc037cc79baedd92 to your computer and use it in GitHub Desktop.
How to mass upload maven artifacts to nexus
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/bash | |
| files="./files.out" | |
| releasefiles="./release.out" | |
| snapshotfiles="./snapshot.out" | |
| username="admin" | |
| password="admin123" | |
| nexusurl="http://nexus/content/repositories/thirdparty/" | |
| snapshoturl="http://nexus/content/repositories/Snapshots/" | |
| releaseurl="http://nexus/content/repositories/Releases/" | |
| find . -name '*.*' -type f | cut -c 3- | grep "/" > $files | |
| find . -name '*.*' -type f | cut -c 3- | grep "SNAPSHOT" | grep "/" > $snapshotfiles | |
| find . -name '*.*' -type f | cut -c 3- | grep -v "SNAPSHOT" | grep "/" > $releasefiles | |
| # while read i; do | |
| # echo "upload $i to $nexusurl" | |
| # curl -v -u $username:$password --upload-file $i "$nexusurl$i" | |
| # done <$files | |
| while read i; do | |
| echo "upload $i to $snapshoturl" | |
| curl -v -u $username:$password --upload-file $i "$snapshoturl$i" | |
| done <$snapshotfiles | |
| while read i; do | |
| echo "upload $i to $releaseurl" | |
| curl -v -u $username:$password --upload-file $i "$releaseurl$i" | |
| done <$releasefiles |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks all and in particular kschuemann.
I found kschuemann's script really useful for this but I had to adapt it to upload a load of thrid party packages, please see nrxm