Reputation: 31
I am using Nexus OSS 2.5.0_04 and we are using Jenkins and Maven to upload and build all our projects. We are able to upload and download to Nexus no problem.
Now I am trying to use Jenkins to deploy the latest snapshot build of our projects. A little background is we have 4 projects with inter-dependencies and at the end of the code building we have an EAR file to deploy as well as a zip file that allows us to deploy all our compiled code and command line tools.
Once all this is build we have a zip, a jar and an ear in our snapshots repo.
I am now trying to use the REST API to download the latest ZIP and EAR file from Nexus. I am able to run:
wget "http://<NEXUS_HOST>/nexus/service/local/artifact/maven/redirect?r=snapshots&g=<OUR GROUPID>&a=<ARTIFACT>&v=LATEST"
This works fine but downloads a jar file. I have tried to specify we want the ZIP (and EAR) with:
wget "http://<NEXUS_HOST>/nexus/service/local/artifact/maven/redirect?r=snapshots&g=<OUR GROUPID>&a=<ARTIFACT>&v=LATEST&p=zip" (also tried with ear. Also tried with the &e=zip...
Each time this generates a 404. There is definitely artifacts in the repo. I also tried to use the content method:
wget "http://<NEXUS_HOST>/nexus/service/local/artifact/maven/redirect?r=snapshots&g=<OUR GROUPID>&a=<ARTIFACT>&v=LATEST&p=zip" --content-disposition
It all 404's. We are using a classifier to give these a proper build number but this doesn't seem to be reflected in the metadata.xml files. When I run the wget I am getting a bad path...
wget "http://<HOST>/nexus/service/local/artifact/maven/content?r=snapshots&g=<GROUPID>&a=<ARTIFACT>&v=LATEST&p=zip" --content-disposition
--2013-06-18 11:40:28-- http://<HOST>/nexus/service/local/artifact/maven/content?r=snapshots&g=<G>&a=<A>&v=LATEST&p=zip
Resolving <HOST>... 172.16.200.42
Connecting to <HOST>|172.16.200.42|:80... connected.
HTTP request sent, awaiting response... 404 Path /com/src/ecomm/ecomm/1.3-SNAPSHOT/ecomm-1.3-20130618.182910-114.zip not found in local storage of repository "Snapshots" [id=snapshots]
2013-06-18 11:40:28 ERROR 404: Path /com/src/ecomm/ecomm/1.3-SNAPSHOT/ecomm-1.3- 20130618.182910-114.zip not found in local storage of repository "Snapshots" [id=snapshots].
Is there a way I can append this classifier to the request? Can't seem to find it in the docs.
I.E., in this example we want to download ecomm-1.3-20130618.171422-113-b705-deploy-package.zip for example but Nexus wants to hand us ecomm-1.3-20130618.182910-114.zip (which does not exist).
EDIT: Fixed. Figured it out. Have to specify the classifer and extension. I was able to get this to work...
wget "http://<HOST>/nexus/service/local/artifact/maven/redirect?r=snapshots&g=<GROUPID>&a=ecomm&v=LATEST&c=b705-deploy-package&e=zip"
I do wish it picked up the classifier from the metadata.xml. I'll have to go through the lucene docs to see if I can search for it somehow.
Upvotes: 1
Views: 2430
Reputation: 29912
The usage of LATEST is not really working well in Maven. You should split it up to find the latest version of the artifact in one request and then download the specific version found as the latest.
Upvotes: 1