Artifactory AQL Get Specific Properties

眉间皱痕 提交于 2021-02-19 04:26:05

问题


I'm using Artifactory 3.5. My artifacts have custom properties. I want to be able to query for all artifacts that have that property and I want the result to show the property and its value. I know I can use:

items.find(...).include("property.*")

However, this returns all properties for the item matching the find criteria. How can I display only the specific property that I want?


回答1:


The include element allows you to include only specific properties in the results

For example, the following query results will only include the artifact name and the "artifactory.licenses" property:

items.find({"@artifactory.licenses" : {"$eq" : "MIT"}}).include("name", "@artifactory.licenses")

This will return for example:

{
"results" : [ {
  "name" : "connection_pool-2.2.0.gem",
  "properties" : [ {
    "key" : "artifactory.licenses",
    "value" : "MIT"
  } ]}
}


来源:https://stackoverflow.com/questions/36755962/artifactory-aql-get-specific-properties

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!