garima
garima

Reputation: 65

How to check if artifact version is already present in nexus using curl command

I have a requirement where i have to check if artifact version is already present or nexus or not. if already present then fail the build else proceed with the deployment.

I tried this curl command to fetch.. but i'm getting error

curl -s -k --user ${credentials} \"${nexusHost}/service/local/artifact/maven/content?r=${repository}&g=${groupId}&a=${artifactId}&v=${version}&p=${packaging}\" -o ${fileName} &> /dev/null

where repository i'm giving "snapshots" .

But this is throwing error. Please help me out here

Upvotes: 0

Views: 2295

Answers (1)

garima
garima

Reputation: 65

Thanks all for the help..

I got this URL which gives all the details related to given g:a:v values. And most importantly it gives the total count also, which was useful in my case.

curl -u $USERNAME:$USERPASS "https://${host}:8081/nexus/service/local/lucene/search?g=${pomGroup}&a=${pomArtifact}&v=${pomVersion}*"

Upvotes: 1

Related Questions