nexus 2获取文件的校验和" raw"知识库

时间:2016-04-01 00:12:26

标签: nexus

使用sonatype nexus 2.x,如何在"站点存储库中获取文件的sha1或md5哈希" (使用curl称为"原始存储库"在nexus 3中)?

There is a related question on SO,但它仅适用于" maven"存储库,具有不同的api端点。

enter image description here

1 个答案:

答案 0 :(得分:2)

点击下载链接并附加?describe=info

curl -H "Accept:application/json" \
"http://nexus.example.com/nexus/service/local/repositories/foobar/content/master-5678.zip?describe=info"

可选的-H "Accept:application/json" curl标志返回json而不是xml

{
   "data":{
      "presentLocally":true,
      "repositoryId":"foobar",
      "repositoryName":"foobar",
      "repositoryPath":"/master-5678.zip",
      "mimeType":"application/zip",
      "uploader":"bob",
      "uploaded":1459458352000,
      "lastChanged":1459458352000,
      "size":715112200,
      "sha1Hash":"d18dd27f4814e0898df98e7aa47cc08c477dfabc",
      "md5Hash":"ded916cf74e7dd97e698285c2880e7a8",
      "repositories":[
         {
            "repositoryId":"foobar",
            "repositoryName":"foobar",
            "path":"/master-5678.zip",
            "artifactUrl":"http://nexus.example.com/nexus/content/repositories/foobar/master-5678.zip",
            "canView":true
         }
      ],
      "canDelete":false
   }
}

感谢Rich @ sonatype的支持。