Results 1 to 2 of 2
  1. #1
    jason2014 is offline Member
    Join Date
    Jul 2014
    Rep Power

    Default how to setup sonar for c# code analysis

    Hi all,

    I am new to Java. I am from .net background.I am trying to setup Sonar server. In one of our training sessions on Sonar, the instructor did the anaysis of solution using pom.xml file and then calling mvn sonar:sonar. I am trying to replicate the entire setup locally.

    1. I installed JRE 7. When I run , java -version, it shows,
    java version "1.7.0"
    Java(TM) SE Runtime Environment (build 1.7.0-b147)
    Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)

    2. I download sonar 3.5 and extracted it to new folder
    3. In that folder I installed sonar-runner 2.4
    3. setup the path and sonar_runner environment variable
    4. downloaded jtds-1.3.1 and placed the jar file in mssql folder of sonar
    5. I create database sonar with username and password as sonar
    6. changed for sql server connection
    7. changed for sql server connection
    8. Ran Sonar.bat and found that it created tables in the sql server db. To me the command prompt seems like it is hanging as after creating table graphs, the last line is
    "jvm 1 | 2014-07-20 13:03:34.967:INFO::Started SelectChannelConnector@
    9000 "

    Is it supposed to stay like this always or should i closed this command prompt by pressing CTRL+C?
    9. Now when i run mvn-sonar:sonar, it says mvn is not recrognizes as internal or external command. A quick search on google showed that I need to install Apache maven something I belive. What is this or how do I solve this issue so that the command mvn sonar:sonar can work?
    10. I would like to use c sharp ecosystem plugin. But when I browse to C# Plugin - SonarQube - Codehaus , I am confused as what to select? i.e. version 3.2, 3.1, 3.0
    11. So if I do a system restart and everytime I have to use sonar, should i run sonar.bat and then do mvn sonar:sonar after modifying the pom.xml file?

    Kindly do answer points 8,9,10,11.
    Last edited by jason2014; 07-20-2014 at 10:34 AM.

  2. #2
    jason2014 is offline Member
    Join Date
    Jul 2014
    Rep Power

    Default Re: how to setup sonar for c# code analysis

    I download 3.7.4 version sonar as plugins were incompatible with 3.5 version , installed apache maven-3.2. and JSE jdk 7.setup envrionment variables. Logged in as admin and installed .net plugins.
    Modified the settings files in maven folder as follows.

    D:\Program Files (x86)\vs2012\Team Tools\Static Analysis Tools\FxCop

    created pom.xml in visual studio project solution folder as follows..

    <project xmlns:xsi="" xmlns:xsd="" xmlns="">



    when i run
    mvn sonar:sonar I get

    INFO: SonarQube Server 3.7.4
    [INFO] [18:34:57.986] Load batch settings
    [INFO] [18:34:58.040] User cache: C:\Users\JamesBond\.sonar\cache
    [INFO] [18:34:58.043] Install plugins
    [INFO] [18:34:58.382] Install JDBC driver
    [WARN] [18:34:58.393] H2 database should be used for evaluation purpose only
    [INFO] [18:34:58.393] Create JDBC datasource for jdbc:h2:tcp://localhost/sonar
    [ERROR] Fail to connect to database
    [INFO] ------------------------------------------------------------------------
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time: 4.742 s
    [INFO] Finished at: 2014-07-20T18:35:00+05:30
    [INFO] Final Memory: 14M/244M
    [INFO] ------------------------------------------------------------------------
    [ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.4:sonar (d
    efault-cli) on project example-java-maven: Can not execute SonarQube analysis: F
    ail to connect to database: Cannot create PoolableConnectionFactory (Connection
    is broken: " Permission denied: connect: localhost" [90
    067-172]) -> [Help 1]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e swit
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR] For more information about the errors and possible solutions, please rea
    d the following articles:
    [ERROR] [Help 1]

    How do I make the command mvn sonar:sonar to work?

Similar Threads

  1. Replies: 0
    Last Post: 02-13-2012, 12:11 PM
  2. HELP with code analysis
    By geenah in forum New To Java
    Replies: 4
    Last Post: 11-18-2011, 07:59 PM
  3. Secure java code allong with the setup of application
    By Annie George in forum NetBeans
    Replies: 0
    Last Post: 01-08-2011, 09:57 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts