sonar installation and configuration

  1. Download sonar

    http://downloads.sonarsource.com/sonarqube/
  2. Decompression sonar package for installation
  3. Set sonar environment variable

    SONAR_HOME: “D:\sonarqube”

    PATH: “%SONAR_HOME%\bin\windows-x86-64”
  4. Start-up sonar

    CMD: StartSonar

  5. log into sonar

    http://localhost:9000/
  6. check issue in sonar web page

eclipse plug-in installation

  1. installation from “Eclipse Marketplace”

  2. Configuration sonar server

sonar with maven

  1. pom.xml fragment for sonar
    <properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<sonar.host.url>http://localhost:9000</sonar.host.url>
<sonar.exclusions>**/*.class, **/*.groovy, src/main/java/spark/*</sonar.exclusions>
</properties>

Note: sonar uses h2 as default database

2. maven CMD for sonar

CMD: mvn sonar:sonar

3. Analyze maven project in sonar GUI

http://localhost:9000/

sonar with gradle

  1. build.gradle fragment for sonar
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: "sonar-runner" group = 'com.shuai.gradle.demo'
description = 'hello gradle for demo' sourceCompatibility = 1.7
version = '1.0' jar {
manifest {
attributes 'Implementation-Title': 'Gradle Quickstart',
'Implementation-Version': version
}
} repositories { maven { url "http://scm0.access.nsn.com/nexus/content/groups/unify/" } } dependencies {
compile group: 'commons-io', name: 'commons-io', version: '2.+'
compile group: 'org.apache.commons', name: 'commons-lang3', version: '3.+'
compile group: 'commons-collections', name: 'commons-collections', version: '3.+'
testCompile group: 'junit', name: 'junit', version: '4.+'
} sonarRunner {
sonarProperties {
property "sonar.host.url", "http://localhost:9000" property "sonar.jdbc.url", "jdbc:h2:tcp://localhost:9092/sonar"
property "sonar.jdbc.driverClassName", "org.h2.Driver"
property "sonar.jdbc.username", "sonar"
property "sonar.jdbc.password", "sonar"
}
} test { systemProperties 'property': 'value' } uploadArchives {
repositories { flatDir { dirs 'repos' } }
}
  1. gradle CMD for sonar

    CMD:

    gradle build cleanEclipse -x test

    gradle sonarRunner
  2. log into sonar

    http://localhost:9000/

analyze codes via sonar in eclipse

  1. associate with sonarQube

  2. analyze codes via sonar

最新文章

  1. EAA脚本语言0.2
  2. IOS 去掉导航栏(UINavigationBar)下方的横线
  3. IOS学习2
  4. 通过XMLHttpRequest和jQuery实现ajax的几种方式
  5. c#实现无标题栏窗口的拖动
  6. [LCA &amp; RMQ] [NOIP2013] 货车运输
  7. RX学习笔记:JavaScript数组操作
  8. Android进阶笔记03:Android应用中实现查看&quot;附近的人&quot;的功能
  9. 5.7.2.1 Math对象
  10. 淘淘商城_day05_课堂笔记
  11. 给HttpClient添加Socks代理
  12. python中的闭包和装饰器
  13. Python基础之 函数名,闭包,和迭代器
  14. Intel x86_64 Architecture Background 2
  15. Dlib与OpenCV图片转换
  16. 常用模块:os模块,logging模块等
  17. 2018九省联考(SHOI2018)
  18. BZOJ1073 k短路(A*算法)
  19. PHP如何将多维数组中的数据批量插入数据库?
  20. ASP.NET MVC4 新手入门教程之四 ---4.添加一个模型

热门文章

  1. 几个比较实用的CSS
  2. vim 如何与外界粘贴复制
  3. Vue(SPA) WebPack模块化打包、SEO优化(Vue SSR服务端同构直出)、全浏览器兼容完整解决方案
  4. ***文件上传控件bootstrap-fileinput的使用和参数配置说明
  5. vuejs、eggjs、mqtt
  6. 【Codechef】BB-Billboards
  7. CSS------制作一个带+-的input框
  8. canvas入门级小游戏《开关灯》思路讲解
  9. JFreeChart 之饼图
  10. BZOJ.1951.[SDOI2010]古代猪文(费马小定理 Lucas CRT)