Skip to content

Instantly share code, notes, and snippets.

@SanSan-
Last active October 11, 2023 09:32
Show Gist options
  • Select an option

  • Save SanSan-/3acc532687df60cfcc037cc79baedd92 to your computer and use it in GitHub Desktop.

Select an option

Save SanSan-/3acc532687df60cfcc037cc79baedd92 to your computer and use it in GitHub Desktop.
How to mass upload maven artifacts to nexus
#!/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
@Mallsey
Copy link

Mallsey commented Oct 11, 2023

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

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