如何获取声纳REST api中的所有心室指标值

Kan*_*raj 3 rest web-services sonarqube

我能够使用以下java代码从声纳REST API获取项目(资源)列表

Sonar sonar = Sonar.create("wwww.example.com/sonar/api/resources?metrics=nloc");
ResourceQuery query = new ResourceQuery();
List resourceList = sonar.findAll(query);
for(Resource resource : resourceList){
  System.out.println(resource.getid()+":"+resource.getMetricIntValue("nloc"));
}
Run Code Online (Sandbox Code Playgroud)

但这导致了

1001:null
1002:null
1003:null
1004:null
Run Code Online (Sandbox Code Playgroud)

为什么代码行的值返回null?

Rus*_*bot 5

文档显示metrics,值为参数ncloc,没有nloc.我觉得你刚收到一个错字.