sonar安装及使用篇
来源:互联网 发布:贪心算法举例 编辑:程序博客网 时间:2024/05/16 18:09
安装步骤:
sonar 下载地址:http://www.sonarsource.org/
下载好以后解压,需要修改配置文件(conf/sonar.properties)
#sonar.web.host: 0.0.0.0#sonar.web.port: 9000将前面的“#”删掉,端口改成指定的端口。
sonar.jdbc.username: sonarsonar.jdbc.password: sonar这里是指定mysql账号,注意密码需要和mysql中的sonar用户一致
sonar.jdbc.url: jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=truesonar.jdbc.driverClassName: com.mysql.jdbc.Drivermysql链接地址。启动之前需要在mysql中创建sonar账号和sonar数据库。
mysql [localhost] {root} ((none)) > CREATE DATABASE IF NOT EXISTS sonar CHARACTER SET utf8 COLLATE utf8_general_ci;Query OK, 1 row affected (0.01 sec)mysql [localhost] {root} ((none)) > grant all privileges on sonar.* to 'sonar'@'localhost' identified by 'sonar';Query OK, 0 rows affected (0.00 sec)mysql [localhost] {root} ((none)) > flush privileges;Query OK, 0 rows affected (0.00 sec)
到bin目录相应的平台目录下运行sonar.sh脚本
sh sonar.sh start
启动后,可以访问http://localhost:9000见识下sonar的界面哈。
用户登陆密码是admin/admin
登陆后,需要配置一些东西。
比方说php,中文语言包。
使用步骤:
sonar简单一点,可以使用sonar-runner,复杂点的就是maven了。这里给大家讲下sonar-runner。
sonar-runner:下载地址:http://docs.codehaus.org/display/SONAR/Installing+and+Configuring+Sonar+Runner
解压后,修改conf/sonar-runner.properties
#----- Default Sonar serversonar.host.url=http://localhost:9000#----- PostgreSQL#sonar.jdbc.url=jdbc:postgresql://localhost/sonar#sonar.jdbc.driver=org.postgresql.Driver#----- MySQLsonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8sonar.jdbc.driver=com.mysql.jdbc.Driver#----- Oracle#sonar.jdbc.url=jdbc:oracle:thin:@localhost/XE#sonar.jdbc.driver=oracle.jdbc.driver.OracleDriver#----- Global database settingssonar.jdbc.username=sonarsonar.jdbc.password=sonar#----- Default directory layout#sonar.sources=src/main/java#sonar.tests=src/test/java#sonar.binaries=target/classes#----- Default source code encodingsonar.sourceEncoding=UTF-8
使用sonar-runner前需要安装几个php扩展:
pear channel-discover pear.pdepend.orgpear install pdepend/PHP_Depend-betapear channel-discover pear.phpmd.orgpear install --alldeps phpmd/PHP_PMD-alphapear install PHP_CodeSniffer
在安装扩展时,出现错误的话,可能是pear的temp_dir没有写权限,可使用以下命令解决:
pear config-set temp_dir ~/tmppear config-set cache_dir ~/tmp/cache/
在项目目录下面,创建sonar-project.properties文件,内容如下:
# Required metadatasonar.projectKey=org.codehaus.sonar:php-sonar-runnersonar.projectName=testsonar.projectVersion=1.0# Comma-separated paths to directories with sources (required)sonar.sources=src,src2 #源码文件夹# Languagesonar.language=php #指定语言# To deactivate features related to unit tests execution and coveragesonar.dynamicAnalysis=false# Encoding of the source filessonar.sourceEncoding=UTF-8
配置好以后,运行sonar-runner,没错误的情况下,进入http://localhost:9000便可以看到代码检查的结果了。
转载请注明来源url:http://blog.csdn.net/icoler/article/details/8286262
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
- sonar安装及使用篇
- Sonar安装配置及使用笔记
- Sonar简介及使用
- sonar学习及简单使用
- SONAR安装及与JENKINS的集成
- sonar入门(安装篇)
- Sonar 安装
- 安装Sonar
- sonar安装
- Sonar安装
- sonar安装
- 代码质量管理平台Sonar的安装、使用
- 【Sonar】Sonar理论篇
- 【Sonar】Sonar实战篇
- sonarQube、sonar-runner、sonar Lint与idea及MySQL配置使用
- 使用Sonar管理代码质量(一)–简述与安装
- sonar服务器端和客户端的安装和使用
- Sonar代码质量管理平台的安装和使用
- DDMS工具使用
- mini2440 3.7v供电
- WINDOWS中如何创建网络驱动器
- 国家气象局天气预报JSON数据接口详解
- apache端口被异常占用导致无法启动的解决方法
- sonar安装及使用篇
- 软件之聊天工具:QQ,MSN,Google talk,Skype, Lync
- 存储过程中的几种循环
- 5 数据网格具有分页功能
- Win7下的内置FTP组件的设置详解
- 学习RTP.Audio.And.Video.For.The.Internet的单词
- BadTokenException: Unable to add window -- token android.os.BinderProxy@438e7108 is not valid;
- uva 11552 - Fewest Flops(dp)
- plsql工具执行更新提交时,没有提示 “提交当前事务”提示框问题