<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 程序调用声纳的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

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

                  相关文档推荐

                  How to send data to COM PORT using JAVA?(如何使用 JAVA 向 COM PORT 发送数据?)
                  How to make a report page direction to change to quot;rtlquot;?(如何使报表页面方向更改为“rtl?)
                  Use cyrillic .properties file in eclipse project(在 Eclipse 项目中使用西里尔文 .properties 文件)
                  Is there any way to detect an RTL language in Java?(有没有办法在 Java 中检测 RTL 语言?)
                  How to load resource bundle messages from DB in Java?(如何在 Java 中从 DB 加载资源包消息?)
                  How do I change the default locale settings in Java to make them consistent?(如何更改 Java 中的默认语言环境设置以使其保持一致?)
                      <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>