nexus 2 get checksum of file in “raw” repository

二次信任 提交于 2020-01-02 23:48:11

问题


Using sonatype nexus 2.x, how do you get the sha1 or md5 hash of a file in a "site repository" (called "raw repositories" in nexus 3) using curl?

There is a related question on SO, however it only applies to "maven" repositories, which has a different api endpoint.


回答1:


Take the download link and append ?describe=info

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

The optional -H "Accept:application/json" curl flag returns json instead of 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
   }
}

Thanks to Rich @ sonatype support.



来源:https://stackoverflow.com/questions/36345939/nexus-2-get-checksum-of-file-in-raw-repository

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!