ARTIFACTORY: How to force my Maven snapshots to resolve the latest by timestamp rather than revision

ARTIFACTORY: How to force my Maven snapshots to resolve the latest by timestamp rather than revision

AuthorFullName__c
Tatarao Vana
articleNumber
000004157
ft:sourceType
Salesforce
FirstPublishedDate
2018-05-25T00:33:54Z
lastModifiedDate
2024-03-21
VersionNumber
10

Using the snapshot keyword to resolve the most recent version will, by default, use the latest revision instead of the timestamp. 

Consider a use case where we have deployed artifacts with the following snapshot revisions. 

libs-snapshot-local/com/jfrog/myapp/1.2.0-SNAPSHOT/myapp-1.2.0-20210205.062218–4.jar <— timestamp is greater
libs-snapshot-local/com/jfrog/myapp/1.2.0-SNAPSHOT/myapp-1.2.0-20210205.052442–5.jar <— this one resolves as latest because of revision number
If you’d like to force the use of the timestamp, you can replace/add the following system property to your artifactory.system.properties file:
artifactory.mvn.metadataSnapshotComparatorFqn=org.artifactory.maven.snapshot.TimestampSnapshotComparator

Thereafter, you’ll need to restart Artifactory for this change to take effect.

By default, both options of resolving the Maven artifact by revision or timestamps are turned off, and it's possible only to resolve the artifact by the exact name. To set Artifactory as one of the choices, it is required to uncomment the right line in the artifactory.system.properties. Both lines are commented by default in a new Artifactory installation:

image1.png