<legend id='uEXn8'><style id='uEXn8'><dir id='uEXn8'><q id='uEXn8'></q></dir></style></legend>

  • <small id='uEXn8'></small><noframes id='uEXn8'>

    1. <i id='uEXn8'><tr id='uEXn8'><dt id='uEXn8'><q id='uEXn8'><span id='uEXn8'><b id='uEXn8'><form id='uEXn8'><ins id='uEXn8'></ins><ul id='uEXn8'></ul><sub id='uEXn8'></sub></form><legend id='uEXn8'></legend><bdo id='uEXn8'><pre id='uEXn8'><center id='uEXn8'></center></pre></bdo></b><th id='uEXn8'></th></span></q></dt></tr></i><div id='uEXn8'><tfoot id='uEXn8'></tfoot><dl id='uEXn8'><fieldset id='uEXn8'></fieldset></dl></div>
    2. <tfoot id='uEXn8'></tfoot>
        <bdo id='uEXn8'></bdo><ul id='uEXn8'></ul>

        从我的 java 程序调用声纳

        Calling Sonar from my java program(从我的 java 程序调用声纳)

          <small id='uhAj3'></small><noframes id='uhAj3'>

          <i id='uhAj3'><tr id='uhAj3'><dt id='uhAj3'><q id='uhAj3'><span id='uhAj3'><b id='uhAj3'><form id='uhAj3'><ins id='uhAj3'></ins><ul id='uhAj3'></ul><sub id='uhAj3'></sub></form><legend id='uhAj3'></legend><bdo id='uhAj3'><pre id='uhAj3'><center id='uhAj3'></center></pre></bdo></b><th id='uhAj3'></th></span></q></dt></tr></i><div id='uhAj3'><tfoot id='uhAj3'></tfoot><dl id='uhAj3'><fieldset id='uhAj3'></fieldset></dl></div>
            <bdo id='uhAj3'></bdo><ul id='uhAj3'></ul>
            <tfoot id='uhAj3'></tfoot>
              <tbody id='uhAj3'></tbody>

              <legend id='uhAj3'><style id='uhAj3'><dir id='uhAj3'><q id='uhAj3'></q></dir></style></legend>

                  本文介绍了从我的 java 程序调用声纳的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我已经在我的本地主机上安装了声纳服务器.而且我能够运行和分析java项目.即使我已经在 Eclipse 上安装了声纳插件.

                  I have installed sonar server on my localhost. And I am able to run and analyse the java project. Even i have installed sonar plugin on eclipse.

                  但我想从我的 java 项目(如简单的 java 类)中运行声纳,并且应该检索声纳结果并能够将其保存在数据库中.我搜索了教程,但找不到答案.请任何人都可以提供示例代码或资源,我可以从中获得知识来克服这项任务.

                  But I want to run sonar from my java project(like simple java class) and should retrieve the sonar results and able to save it in database. I searched for the tutorial but unable to find the answer for this. Please anyone can give sample code or resource where I can gain knowledge to overcome this task.

                  import javax.annotation.Resource;
                  
                  
                  import org.sonar.wsclient.Host;
                  import org.sonar.wsclient.Sonar;
                  import org.sonar.wsclient.connectors.HttpClient4Connector;
                  import org.sonar.wsclient.services.*;
                  
                  public class SonarTask1{
                  
                  public static void main(String[] args) {
                      //public void Hi(){
                      String url = "http://localhost:9000";
                      String login = "admin";
                      String password = "admin";
                      Sonar sonar = new Sonar(new HttpClient4Connector(new Host(url, login, password)));
                  
                      String projectKey = "java-sonar-runner-simple";
                      String manualMetricKey = "burned_budget";
                  
                      sonar.create(ManualMeasureCreateQuery.create(projectKey, manualMetricKey).setValue(50.0));
                  
                      for (ManualMeasure manualMeasure : sonar.findAll(ManualMeasureQuery.create(projectKey))) {
                        System.out.println("Manual measure on project: " + manualMeasure);
                      }
                    }
                  
                  }
                  

                  推荐答案

                  您可以通过 Java 程序做两件事:

                  There are 2 things you can do from a Java program:

                  • 启动声纳分析:查看 Sonar Ant 任务(在方法#launchAnalysis 中)了解如何轻松完成.

                  • launch a Sonar analysis: look into the Sonar Ant Task (in method #launchAnalysis) to see how to do that very easily.

                  从 Sonar 服务器检索结果:检查 Web API 为此目的

                  retrieve results from the Sonar server: check the Web API for that purpose

                  这篇关于从我的 java 程序调用声纳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Slf4j LoggerFactory.getLogger and sonarqube(Slf4j LoggerFactory.getLogger 和 sonarqube)
                  Security - Array is stored directly(安全性 - 数组直接存储)
                  SonarQube quot;Class Not Foundquot; during Main AST Scan(SonarQube“找不到类在主 AST 扫描期间)
                  Integrate Spock#39;s test with Sonar(将 Spock 的测试与声纳集成)
                  How do I make Hudson/Jenkins fail if Sonar thresholds are breached?(如果违反声纳阈值,我如何让 Hudson/Jenkins 失败?)
                  automatically add curly brackets to all if/else/for/while etc. in a java code-base(自动将大括号添加到 java 代码库中的所有 if/else/for/while 等)
                      <tbody id='59Yhm'></tbody>
                      <bdo id='59Yhm'></bdo><ul id='59Yhm'></ul>
                      <tfoot id='59Yhm'></tfoot>

                      <small id='59Yhm'></small><noframes id='59Yhm'>

                          <legend id='59Yhm'><style id='59Yhm'><dir id='59Yhm'><q id='59Yhm'></q></dir></style></legend>

                          <i id='59Yhm'><tr id='59Yhm'><dt id='59Yhm'><q id='59Yhm'><span id='59Yhm'><b id='59Yhm'><form id='59Yhm'><ins id='59Yhm'></ins><ul id='59Yhm'></ul><sub id='59Yhm'></sub></form><legend id='59Yhm'></legend><bdo id='59Yhm'><pre id='59Yhm'><center id='59Yhm'></center></pre></bdo></b><th id='59Yhm'></th></span></q></dt></tr></i><div id='59Yhm'><tfoot id='59Yhm'></tfoot><dl id='59Yhm'><fieldset id='59Yhm'></fieldset></dl></div>