sonarqube的安装

1.安装mysql,把默认引擎改为innodb配置了几个提高性能的参数,参看文档
default-storage-engine=INNODB
innodb_buffer_pool_size =2.5G
query_cache_size=128M
query_cache_type=1
2.unzip sonarqube-5.1.1.zip 部署webserver
vi /opt/sonarqube-5.1.1/conf/sonar.properties 添加
sonar.jdbc.url=jdbc:mysql://192.168.31.241:8066/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true&useConfigs=maxPerformance
sonar.jdbc.username=root
sonar.jdbc.password=123456
以上设置后运行出错,重新安装了jdk
在/opt/sonarqube-5.1.1/bin/linux-x86-64运行 ./sonar.sh start
3.安装analyzer,
解压在opt下
vi /opt/sonar-runner-2.4/conf/sonar-runner.properties 填写数据库信息和webserver一致
vi profile
添加export SONAR_RUNNER_HOME=/opt/sonar-runner-2.4
export PATH=$JAVA_HOME/bin:$JAVA_HOME/jre/bin:$PATH:$HOME/bin:$SONAR_RUNNER_HOME/bin
添加完成后重启机器
sonar-runner -h 可以看到安装成功
If you need more debug information you can add the sonar.verbose property by adding the command line parameter -Dsonar.verbose=true.
settings-System-update center 添加要使用的语言插件
5.运行,拷贝文件到机器上,在src的同级目录放置sonar-project.properties
# must be unique in a given SonarQube instance
sonar.projectKey=mytest:portalyun
# this is the name displayed in the SonarQube UI
sonar.projectName=My project
sonar.projectVersion=1.0

# Path is relative to the sonar-project.properties file. Replace "\" by "/" on Windows.
# Since SonarQube 4.2, this property is optional if sonar.modules is set.
# If not set, SonarQube starts looking for source code from the directory containing
# the sonar-project.properties file.
sonar.sources=src
sonar.language=java

# Encoding of the source code. Default is default system encoding
sonar.sourceEncoding=UTF-8
~                               
6.在系统更新中心中添加了c++插件,使用过程中出现no license for cpp,因为该插件为商业插件
https://github.com/wenns/sonar-cxx/releases
下载后安装
  • Make sure you know which plugin release is compatible with your SonarQube instance (see SonarQube compatibility matrix)
  • Download one of the released jar packages into the SONARQUBE_HOME/extensions/plugins directory
  • Restart the SonarQube server
  • Navigate to the Update Center (<Your SonarQube URL>/updatecenter). The Update Center should list "C++ (Community)" on the tab "Installed Plugins":

遇到问题:
Caused by: The svn blame command [svn blame --xml --non-interactive -x -w src/main/java/com/suirui/core/base/LoginHandlerInterceptor.java] failed: svn: The path 'src/main/java/com/suirui/core/base' appears to be part of a Subversion 1.7 or greater
解决:安装subversion 1.8
configure: Apache Portable Runtime (APR) library configuration
checking for APR... no
解决:因为subversion的17及以上版本 the dependencies distribution   subversion-deps-*  is no longer available in 1.7 and later.因此网上建议下载1.6的版本然后将1.6的apr拷贝到1.8的目录
在apr目录下执行 ./configure --prefix=/usr/local/apr make make install
在apr-util目录下执行./configure --prefix=/usr/local/apr --with-apr=/uar/local/apr make make install
之后在subversion目录下执行./configure --prefix=/usr/local/apr --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr 安装
提示:configure: error: Subversion requires SQLite机器上已安装但是版本低
解决:yum install sqlite
解压
mv sqlite-amalgamation-3071501 sqlite-amalgamation
-bash: /usr/bin/svn: No such file or directory
解决:subversion安装完需要添加path
PATH=$PATH:/usr/local/svn/bin
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Sonar简介 Sonar是一个用于代码质量管理的开源平台,用于管理源代码的质量,可以从七个维度检测代码质量 通过插件形式,可以支持包括java,C#,C/C++,PL/SQL,Cobol,JavaScrip,Groovy等等二十几种编程语言的代码质量管理与检测 sonarQube能带来什么? Developers' Seven Deadly Sins 1.糟糕的复杂度分布 文件、类、方法等,如果复杂度过高将难以改变,这会使得开发人员难以理解它们, 且如果没有自动化的单元测试,对于程序中的任何组件的改变都将可能导致需要全面的回归测试 2.重复 显然程序中包含大量复制粘贴的代码是质量低下的 sonar可以展示源码中重复严重的地方 3.缺乏单元测试 sonar可以很方便地统计并展示单元测试覆盖率 4.没有代码标准 sonar可以通过PMD,CheckStyle,Findbugs等等代码规则检测工具规范代码编写 5.没有足够的或者过多的注释 没有注释将使代码可读性变差,特别是当不可避免地出现人员变动时,程序的可读性将大幅下降 而过多的注释又会使得开发人员将精力过多地花费在阅读注释上,亦违背初衷 6.潜在的bug sonar可以通过PMD,CheckStyle,Findbugs等等代码规则检测工具检测出潜在的bug 7.糟糕的设计(原文Spaghetti Design,意大利面式设计) 通过sonar可以找出循环,展示包与包、类与类之间的相互依赖关系 可以检测自定义的架构规则 通过sonar可以管理第三方的jar包 可以利用LCOM4检测单个任务规则的应用情况 检测耦合
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值