今天尝试在IOS上 用sonar, 结果又是悲剧了。
1. 下载SonarQube
2. brew installsonar-runner
3. brew installxctool
4. brew install https://gist.githubusercontent.com/TonyAnhTran/e1522b93853c5a456b74/raw/157549c7a77261e906fb88bc5606afd8bd727a73/oclint.rb
oclint -version
xcodebuild -version
3. 下载并解压SonarQube(例如:"/etc/sonarqube")
4.将sonar-objective-c-plugin-0.3.2-SNAPSHOT.jar放到SonarQube的扩展插件目录下(例如:"/etc/sonarqube/extensions/plugins")
5.配置sonar.properties (例如:"/etc/sonarqube/conf")
6. 启动SonarQube服务器
$/etc/sonarqube/bin/macosx-universal-64/sonar.sh console
7. 测试SonarQube
http://localhost:9000/
8. 下载并解压Sonar Runner(例如:"/etc/sonar-runner")
9. 配置SonarRunner下的sonar-runner.properties (例如:"/etc/sonar-runner/conf/sonar-runner.properties")
扫描代码:
在bash中进入代码目录(.xcodeproj文件所在目录), 执行xcodebuild | tee xcodebuild.log
在bash中执行 oclint-xcodebuild xcodebuild.log
在bash中执行oclint-json-compilation-database ---report-type pmd -o sonar-reports/oclint.xml。
将sonar-project.properties存放到代码目录中,根据具体情况编辑对应的项,需要特别注意其中的sonar.objectivec.project和sonar.objectivec.appScheme
运行:/etc/sonar-runner/bin/sonar-runer.sh
结果是没有跑起来。
然后去看别人是怎么装的, 似乎都要装Mysql.
http://blog.csdn.net/irene_jia/article/details/12750749
http://blog.csdn.net/hunterno4/article/details/11687269
然后去下载了个mysql,等待了半天。
好不容易装好了,却启动不了。
aliasmysql=/usr/local/mysql/bin/mysql
aliasmysqladmin=/usr/local/mysql/bin/mysqladmin
给root创建密码:
/usr/local/mysql/bin/mysqladmin-u root password root
使用终端来打开或关闭mysql:
sudo/Library/StartupItems/MySQLCOM/MYSQLCOM [start | stop | restart]
源文档 <http://www.2cto.com/database/201301/183252.html>
还是启动不起来,
报错:
Can't connect to local MySQL server through socket'/tmp/mysql.sock'错误
源文档 <http://www.ithov.com/server/130921.shtml>
检查一下mysql的运行状态
[root@localhostmysql]# ps -ef | grep mysql
root 32092 2108 0 22:43 pts/0 00:00:00 grep mysql
查看/tmp文件夹的确没有mysql.sock文件,
通过find命令查找
[root@localhost /]#find / -name mysql.sock
/var/lib/mysql/mysql.sock
原来安装到/var/lib/mysql/mysql.sock这个位置啦,我们需要修改my.cnf文件
[root@localhost /]#vi /usr/local/mysql/my.cnf
[client]
character-set-server= utf8
port = 3306
socket = /var/lib/mysql/mysql.sock
......
保存之后即出,重新启动mysql。
[root@localhostmysql]# /usr/local/mysql/bin/mysqld_safe &
源文档 <http://www.ithov.com/server/130921.shtml>
也不行,我的命怎么这么苦呢。
2. 在/usr/local/etc/ 下创建或修改 my.cnf,示例:
[client]
port = 3306
socket = /tmp/mysql.sock
default-character-set = utf8
[mysqld]
collation-server = utf8_unicode_ci
character-set-server = utf8
init-connect ='SET NAMES utf8'
max_allowed_packet = 64M
bind-address = 127.0.0.1
port = 3306
socket = /tmp/mysql.sock
innodb_file_per_table=1
[mysqld_safe]
timezone = '+0:00'
源文档 <http://segmentfault.com/q/1010000000094608>
悲剧的一天!