有没有办法使用完全限定的类名来搜索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
但这不起作用。
答案 0 :(得分:3)
您可以使用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