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

猜你喜欢

转载自blog.csdn.net/sunshine2853/article/details/75459390
今日推荐