我知道Nexus支持REST请求。您能否告诉我如何根据Nexus从存储库请求某个工件的大小?
谢谢。
答案 0 :(得分:4)
您有以下选项:使用工件内容URI的完整路径并添加参数describe=info
例如:
返回一个ArtifactInfoResourceResponse,它是一个包含以KB为单位的工件大小的XML:
<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>