有没有办法使用完全限定的类名从 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/