Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a URL for the latest snapshot for an artifact in Artifactory?

Tags:

artifactory

I would like to make a permalink to the latest snapshot version of an artifact in Artifactory. If we are on 1.0-SNAPSHOT, I would like a URL that downloads the latest 1.0-SNAPSHOT JAR. I can find the latest artifact by locating the artifact on our server at http://hostname/artifactory/libs-snapshot/groupId/artifactId/1.0-SNAPSHOT/. Other than checking the timestamps, I can figure out which one if the latest by opening maven-metadata.xml and matching metadata/versioning/snapshot timestamp and buildNumber with a JAR in the same directory. This could be scripted, but ideally Artifactory already has a way to construct a permalink in this manner. Does Artifactory provide such a URL?

like image 607
BennyMcBenBen Avatar asked Jul 11 '13 16:07

BennyMcBenBen


People also ask

How do I get the latest artifact from Artifactory?

Details. When trying to resolve the latest artifact version using the “Artifact Latest Version Search Based on Layout” REST API call, Artifactory will identify the version according to the configured layout of the repository.

How do I know if I have the latest version of Artifactory?

How to Check Your Artifactory Version Number Through Your Artifactory SaaS Account? Do the following: Login to your Artifactory SaaS account as a user who has Artifactory admin access privileges. Modify the webpage address by appending /api/system/version to your Artifactory SaaS base URL.

What is a snapshot Artifactory?

Maven Snapshot Version Behavior Artifactory supports centralized control of how snapshots are deployed into a repository, regardless of end user-specific settings. This can be used to guarantee a standardized format for deployed snapshots within your organization.

How do I access the Artifactory repository?

Search in the browser: You can search for a specific repository in both browsers by clicking on the filter icon. Keyboard navigation: While in the browser, type the name of the repository you are searching for and Artifactory will navigate you to that repository.


3 Answers

Doing the normal query for the entry with artifactId-1.0-SNAPSHOT.jar in the URL name should return automatically the latest snapshot. See the doc here

One thing: This is base either on the latest creation date if no pom present, or latest creation of the pom if there are some. Mixing pom and non-pom deployment may results in strange results!

like image 63
Fred Simon Avatar answered Oct 22 '22 19:10

Fred Simon


I tried using shell script and it worked for me.

Step1: Get an encrypted password for your user account by clicking on user name or create a common user. Go to using your secure password section in the following link http://www.jfrog.com/confluence/display/RTF/Centrally+Secure+Passwords

Step 2: In your local machine create a temp folder and type this curl(may be wget for windows) command:

curl -o tmp/foo.jar --user <username>:<encrypted_password> <artifactory_url>/list/libs-snapshot-local/com/search/foo/1.0/foo-1.0-SNAPSHOT.JAR

Your foo.jar in tmp folder is latest version. If we dont give timestamp as like above, it will download latest artifact in that version. Hope this helps!

like image 29
phoenix Avatar answered Oct 22 '22 19:10

phoenix


This might be helpful:

How to download the latest artifact from Artifactory repository?

Although there is no permalink ability in the free version of Artifactory, it can be scripted easily as you suggest. I have provided a quick script to do that in the referenced question.

Hope it helps.

like image 1
btiernay Avatar answered Oct 22 '22 18:10

btiernay