If I deploy an artifact to a Maven repository with version number 1.0.0-SNAPSHOT, it will get an internal version number of the form 1.0.0-21321323-2 (timestamp and number). How can I find out this version number?
When deploying an artifact to Artifactory you get a JSON response which includes the URI of the deployed artifact. You can use that to get the timestamp version. For example:
{
"repo" : "libs-snapshot-local",
"path" : "/org/jfrog/buildinfo/build-info-extractor-maven3/2.5.4-SNAPSHOT/build-info-extractor-maven3-2.5.4-20160205.203000-1.jar",
"created" : "2016-02-05T22:30:00.624+02:00",
"createdBy" : "admin",
"downloadUri" : "http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/buildinfo/build-info-extractor-maven3/2.5.4-SNAPSHOT/build-info-extractor-maven3-2.5.4-20160205.203000-1.jar",
"mimeType" : "application/java-archive",
"size" : "67966",
"checksums" : {
"sha1" : "f608440d5aadc64a5ef50320a385aeae49abd58a",
"md5" : "a844a8ab8226ff25854127480f3cfeac"
},
"originalChecksums" : {
},
"uri" : "http://localhost:8081/artifactory/libs-snapshot-local/org/jfrog/buildinfo/build-info-extractor-maven3/2.5.4-SNAPSHOT/build-info-extractor-maven3-2.5.4-20160205.203000-1.jar"
}
Another option is using the latest version search REST API which allows searching for the latest artifact version by groupId and artifactId. For example:
$ curl -uadmin:password "http://localhost:8081/artifactory/api/search/latestVersion?g=org.jfrog.buildinfo&a=build-info-extractor-maven3&v=2.5.4-SNAPSHOT&repos=libs-snapshot-local"
2.5.4-20160205.203000-1
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.