repository - Artifactory Rest API 完全限定类搜索

标签 repository artifactory

有没有办法使用完全限定的类名从 Artifactory 进行搜索(类似于 Artifactory Web UI 中的 class-searth)。基于此Documentation ,我知道我可以使用通配符(*)和 .class 文件扩展名,如下所示:-

GET /api/search/archive?name=*Logger.class&repos=third-party-releases-local,repo1-cache

但我正在寻找一种使用与此类似的完全限定类名的方法:-

GET /api/search/archive?name=org.apache.log4j.Logger&repos=third-party-releases-local,repo1-cache

但这不起作用。

最佳答案

您可以使用Artifactory query language为此。
例如,在 jcenter-cache 存储库中搜索名为 org/apache/log4j/Logger.class 的归档项目的查询将是

items.find({
    "repo" : "jcenter-cache",
    "archive.entry.name":{"$eq":"Logger.class "}, 
    "archive.entry.path":{"$eq":"org/apache/log4j"}
})

响应将是

{
"results" : [ {
  "repo" : "jcenter-cache",
  "path" : "org/apache/log4j/com.springsource.org.apache.log4j/1.2.16",
  "name" : "com.springsource.org.apache.log4j-1.2.16.jar",
  "type" : "file",
  "size" : 481202,
  "created" : "2015-12-30T20:57:36.305Z",
  "created_by" : "admin",
  "modified" : "2010-08-04T13:18:06.000Z",
  "modified_by" : "admin",
  "updated" : "2015-12-30T20:57:36.354Z"
} ],
"range" : {
  "start_pos" : 0,
  "end_pos" : 1,
  "total" : 1
}
}

要使用curl运行此类查询,当查询位于文件名aql.txt内时,请使用以下命令

curl -H "content-type: text/plain" -uuser:password --data @aql.txt http://my-artifactory-host/api/search/aql

关于repository - Artifactory Rest API 完全限定类搜索,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34533869/

相关文章:

continuous-integration - 使用自定义存储库布局检索最新版本的 Artifactory

nginx - 将 Kubernetes 与 Artifactory/Nginx 代理一起使用

git - 更改 Git 存储库的根目录

GitHub 与 Google Code 的业余爱好项目

android - 由于 GnuTLS 错误,Repo init 无法成功

java - 如何从 Spring Data JPA GROUP BY 查询中返回自定义对象

symfony - Symfony 2:从存储库创建服务

docker - 将 docker https ://index. docker.io/v1/中的注册表更改为 V2

artifactory - 无法收集对本地 Artifactory Pypi 存储库的补丁依赖

groovy - 通过 REST API 进行的 Artifactory 搜索导致 "Bad request"错误