koreanbad.blogg.se

Download artifacts from nexus repository
Download artifacts from nexus repository








download artifacts from nexus repository

It will also report if it was successful at downloading it or not. This is downloading everything and preserving the folder structure so later you can upload everything using Maven (assuming Maven2 repo). # = DOWNLOAD EVERYTHING =Įcho Successfully downloaded artifact: $url | tee -a $logfile 2>&1Įcho ERROR: Failed to download artifact: $url with error code: $responseCode | tee -a $logfile 2>&1 so you can loop through the lines of the output file and download them using curl. You can use curl to retrieve a list of all your artifacts download URLs by executing: curFolder=`pwd`Īrtifacts=( $(echo $response | sed -n 's|.*"downloadUrl" : "\(*\)".*|\1|p') )Ĭat artifacts.temp | grep "$filter" > $outputFileĪt this point you have all the artifacts filtered out from sha1 and md5 files, metadata etc. Sed 's///g' artifacts2.temp > artifacts3.tempĬat artifacts3.temp | grep "$sourceFolder" > $outputFile Sed 's/,//g' artifacts1.temp > artifacts2.temp

  • Removing the output file if it exists when you do consecutive runs.
  • Setting the curFolder to the result of pwd.
  • Preserving spaces in the URLs and converting to %20 for download.
  • download artifacts from nexus repository

  • Taking back a simple filter (for e g a sub-folder).
  • I am a little bit intrigued by the fact that there is no "download all files in a folder" in the REST API ResponseCode=`cat response.header | sed -n '1p' | cut -d' ' -f2`Įcho Successfully downloaded artifact: $urlĮcho ERROR: Failed to download artifact: $url with error code: $responseCode

    download artifacts from nexus repository

    Urls=($(cat $outputFile)) > /dev/null 2>&1Ĭurl -vks -u "$sourceUser:$sourcePassword" -D response.header -X GET "$url" -O > /dev/null 2>&1 # cat artifacts.temp | grep "$filter" > $outputFileĬontToken=( $(echo $response | sed -n 's|.*"continuationToken" : "\(*\)".*|\1|p') ) Sed 's///g' artifacts.temp > artifacts1.temp Sed 's/,//g' artifacts1.temp > artifacts.temp Sed 's/\"//g' artifacts.temp > artifacts1.temp Response=`curl -ksSL -u "$sourceUser:$sourcePassword" -X GET -header 'Accept: application/json' "$url"` Url=$sourceServer"/service/rest/v1/assets?continuationToken="$contToken"&repository="$sourceRepoĮcho Processing repository token: $contToken | tee -a $logfile Url=$sourceServer"/service/rest/v1/assets?repository="$sourceRepo I know one issue is that the very first download this script initiates is put in the wrong directory.

    download artifacts from nexus repository

    This script is by no means perfect and you may need to edit it. I slightly modified it and posted it below. The script above really helped me with this issue.










    Download artifacts from nexus repository