SonarQube 安装步骤

  1. 确定 JDK 和 MySQL 已经成功安装。
  2. 下载 SonarQube 及工具 SonarQube Runner,下载地址:http://www.sonarqube.org/downloads/
  3. 解压文件,将下载的 SonarQube 和 SonarQube Runner 解压到指定的目录。
  4. 添加环境变量:
    export SONAR_HOME=/home/huey/huey/sonar/sonarqube-5.0.1
    export SONAR_RUNNER_HOME=/home/huey/huey/sonar/sonar-runner-2.4
    export PATH=${SONAR_RUNNER_HOME}/bin:$PATH
  5. 数据库(MySQL)的配置:
    CREATE DATABASE sonar CHARACTER SET utf8 COLLATE utf8_general_ci;
    CREATE USER 'sonar' IDENTIFIED BY 'sonar';
    GRANT ALL ON sonar.* TO 'sonar'@'%' IDENTIFIED BY 'sonar';
    GRANT ALL ON sonar.* TO 'sonar'@'localhost' IDENTIFIED BY 'sonar';
    FLUSH PRIVILEGES;

    在创建数据库与用户后, 修改 sonar.properties 属性文件:

    sonar.jdbc.username=sonar
    sonar.jdbc.password=sonar
    sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
    sonar.jdbc.driverClassName=com.mysql.jdbc.Driver
  6. 根据数据库配置在 SonarQube Runner 的属性文件 sonar-runner.properties 取消对应的注释:
    #Configure here general information about the environment, such as SonarQube DB details for example
    #No information about specific project should appear here #----- Default SonarQube server
    sonar.host.url=http://localhost:9000 #----- PostgreSQL
    #sonar.jdbc.url=jdbc:postgresql://localhost/sonar #----- MySQL
    sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8 #----- Oracle
    #sonar.jdbc.url=jdbc:oracle:thin:@localhost/XE #----- Microsoft SQLServer
    #sonar.jdbc.url=jdbc:jtds:sqlserver://localhost/sonar;SelectMethod=Cursor #----- Global database settings
    sonar.jdbc.username=sonar
    sonar.jdbc.password=sonar #----- Default source code encoding
    sonar.sourceEncoding=UTF-8 #----- Security (when 'sonar.forceAuthentication' is set to 'true')
    sonar.login=admin
    sonar.password=admin
  7. 启动 SonarQube 服务(需要根据不同的平台选择相应的目录):
    sh sonar.sh start
  8. 至此,已经能够使用 SonarQube,访问 http://localhost:9000

客户端 SonarQube Runner 的使用

  1. 准备一个简单的示例项目 helloworld

    helloworld
    ├── bin
    │   └── com
    │   └── huey
    │   └── helloworld
    │   └── HelloWorld.class
    └── src
    └── com
    └── huey
    └── helloworld
    └── HelloWorld.java
  2. 在项目配置跟路径下,创建配置文件 sonar-project.properties,SonarQube Runner 执行时会读取该文件。
    # required metadata
    sonar.projectKey=com.huey.helloworld
    sonar.projectName=Hello World
    sonar.projectVersion=1.0 # path to source directories (required)
    sonar.sources=src # path to project binaries (optional), for example directory of Java bytecode
    sonar.binaries=bin # The value of the property must be the key of the language.
    sonar.language=java
    # Additional parameters
    sonar.my.property=value
  3. 在项目的根目录下,执行启动项目命令:
    sonar-runner
  4. 刷新 http://localhost:9000 ,项目 helloworld 已经启动:

SonarQube(5.0.1) 环境的安装配置的更多相关文章

  1. Maven(3.0.5) 环境的安装配置

    Maven 安装步骤 JDK 安装:在使用 Maven 之前,要确定已经安装了 JDK. huey@huey-K42JE:~$ java -version java version "1.7 ...

  2. Centos 7环境下安装配置Hadoop 3.0 Beta1简记

    前言 由于以前已经写过一篇Centos 7环境下安装配置2.8的随笔,因此这篇写得精简些,只挑选一些重要环节记录一下. 安装环境为:两台主机均为Centos 7.*操作系统,两台机器配置分别为: 主机 ...

  3. Windows基础环境_安装配置教程(Windows7 64、JDK1.8、Android SDK23.0、TortoiseSVN 1.9.5)

    Windows基础环境_安装配置教程(Windows7 64.JDK1.8.Android SDK23.0.TortoiseSVN 1.9.5) 安装包版本 1)     JDK版本包 地址: htt ...

  4. 【转】android 最新 NDK r8 在window下开发环境搭建 安装配置与使用 详细图文讲解,完整实际配置过程记录(原创)

    原文网址:http://www.cnblogs.com/zdz8207/archive/2012/11/27/android-ndk-install.html android 最新 NDK r8 在w ...

  5. android 最新 NDK r8 在window下开发环境搭建 安装配置与使用 详细图文讲解,完整实际配置过程记录(原创)

      android 最新 NDK r8 在window下开发环境搭建 安装配置与使用 详细图文讲解,完整实际配置过程记录(原创) 一直想搞NDK开发却一直给其他事情耽搁了,参考了些网上的资料今天终于把 ...

  6. Android NDK r8 Cygwin CDT 在window下开发环境搭建 安装配置与使用 具体图文解说

    版权声明:本博客全部文章均为原创.欢迎交流.欢迎转载:转载请勿篡改内容,而且注明出处,谢谢! https://blog.csdn.net/waldmer/article/details/3272500 ...

  7. MySQL基础环境_安装配置教程(Windows7 64或Centos7.2 64、MySQL5.7)

    MySQL基础环境_安装配置教程(Windows7 64或Centos7.2 64.MySQL5.7) 安装包版本 1)     VMawre-workstation版本包 地址: https://m ...

  8. Linux基础环境_安装配置教程(CentOS7.2 64、JDK1.8、Tomcat8)

    Linux基础环境_安装配置教程 (CentOS7.2 64.JDK1.8.Tomcat8) 安装包版本 1)     VMawre-workstation版本包 地址: https://my.vmw ...

  9. Linux环境Hive安装配置及使用

    Linux环境Hive安装配置及使用 一.Hive Hive环境前提 二.Hive架构原理解析 三.Hive-1.2.2单机安装流程 (1) 解压apache-hive-1.2.2-bin.tar.g ...

随机推荐

  1. HDU-4704 Sum 大数幂取模

    题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=4704 题意:求a^n%m的结果,其中n为大数. S(1)+S(2)+...+S(N)等于2^(n-1) ...

  2. Bzoj-2190 仪仗队 欧拉函数

    题目链接:http://www.lydsy.com/JudgeOnline/problem.php?id=2190 简单的欧拉函数题,实际上就是求gcd(x,y)=1, 0<=x,y<=n ...

  3. ubuntukylin提取root权限及mongoDB部署

    UbuntuKylin下安装Mongodb (参照UbuntuKylin下安装Mongodb一文安装成功后的心得) 1.官网下载安装包  http://www.mongodb.org/dr/fastd ...

  4. JavaAPI之Runtime类以及bat文件开启应用程序

    package OtherToolsClass; import java.io.IOException; public class RuntimeDemo { /** * @param args */ ...

  5. A Tour of Go Methods

    Go does not have classes. However, you can define methods on struct types. The method receiver appea ...

  6. IOS-- UIView中的坐标转换

    // 将像素point由point所在视图转换到目标视图view中,返回在目标视图view中的像素值 - (CGPoint)convertPoint:(CGPoint)point toView:(UI ...

  7. MSSQLSERVER数据库- 触发器

    参考了别人写的文章,我删除掉一些废话,只看一些我想看的信息.整理了一下,记录在这里,方便以后查阅! 1.当触发INSERT触发器时,新的数据行就会被插入到触发器表和inserted表中. 2.当触发d ...

  8. Windows Azure Website类别、限制条件

    在Azure中Website是一个典型的SAAS,用户可以很容易地搭建自己想要的网站,可以基于多种编程语言(ASP.NET/ASP/PHP/Node.JS等)和网站框架. Website有三种分类分别 ...

  9. 一个通用数据库访问类(C#,SqlClient)

    本文转自:http://www.7139.com/jsxy/cxsj/c/200607/114291.html使用ADO.NET时,每次数据库操作都要设置connection属性.建立connecti ...

  10. PHP函数ip2long转换IP时数值太大产生负数的解决办法

    有两种办法: 1. bindec( decbin($long))  利用bindec和decbin两个函数转换一次就没有问题了 我一直在用上面的方法,但是在升级到PHP7以后就不起作用了(因为最近只进 ...