如何从 Nexus 存储库请求工件的大小? [英] How to request size of the artifact from Nexus repository?
本文介绍了如何从 Nexus 存储库请求工件的大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道 Nexus 支持 REST 请求.你能告诉我如何基于 Nexus 从存储库请求某些工件的大小吗?
I know Nexus support REST request. Would you please tell me how to request from repository based on Nexus the size of certain artifact?
谢谢.
推荐答案
您有以下选项:使用工件内容 URI 的完整路径并添加参数 describe=info
You have the following option: Use the full path to the artifact content URI and add the parameter describe=info
例如:
返回一个 ArtifactInfoResourceResponse,它是一个 XML,包含以 KB 为单位的工件大小:
Returns an ArtifactInfoResourceResponse, which is an XML that contains the artifact size in KB:
<org.sonatype.nexus.rest.model.ArtifactInfoResourceResponse>
<data>
<presentLocally>true</presentLocally>
<repositoryId>maven-sites</repositoryId>
<repositoryName>maven-sites</repositoryName>
<repositoryPath>/nexus-oss/css/maven-theme.css</repositoryPath>
<mimeType>text/css</mimeType>
<uploader>grid</uploader>
<uploaded>1324414832000</uploaded>
<lastChanged>1324414832000</lastChanged>
<size>2801</size>
<sha1Hash>f773e0309d4c0f7aab4aac0ec3ae50088ad02394</sha1Hash>
<md5Hash>61d12a98b59a0fefcc3b0ed8313239de</md5Hash>
<repositories>
<org.sonatype.nexus.rest.model.RepositoryUrlResource>
<repositoryId>maven-sites</repositoryId>
<repositoryName>maven-sites</repositoryName>
<path>/nexus-oss/css/maven-theme.css</path>
<artifactUrl>https://repository.sonatype.org/content/repositories/maven-sites/nexus-oss/css/maven-theme.css</artifactUrl>
<canView>true</canView>
</org.sonatype.nexus.rest.model.RepositoryUrlResource>
</repositories>
<canDelete>false</canDelete>
</data>
</org.sonatype.nexus.rest.model.ArtifactInfoResourceResponse>
这篇关于如何从 Nexus 存储库请求工件的大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文