简体   繁体   English

部署SNAPSHOT版本-获取(时间戳)版本号

[英]Deploy SNAPSHOT version - get the (timestamped) version number

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). 如果将工件部署到版本号为1.0.0-SNAPSHOT的Maven存储库,它将获得内部版本号,形式为1.0.0-21321323-2(时间戳和编号)。 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. 将工件部署到Artifactory时,您将获得一个JSON响应,其中包括已部署工件的URI。 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. 另一种选择是使用最新版本的搜索 REST API,该API允许按groupId和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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM