从 http://www.sonarsource.org/downloads/ 下载最新版的sonar安装包,上传到服务器上,解压。
编辑conf目录下的sonar.properties文件
sonar.web.host: 0.0.0.0 sonar.web.port: 9090 sonar.web.context: / sonar.jdbc.username: sonar sonar.jdbc.password: sonar sonar.jdbc.url: jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true sonar.jdbc.driverClassName: com.mysql.jdbc.Driver #----- Connection pool settings sonar.jdbc.maxActive: 20 sonar.jdbc.maxIdle: 5 sonar.jdbc.minIdle: 2 sonar.jdbc.maxWait: 5000 sonar.jdbc.minEvictableIdleTimeMillis: 600000 sonar.jdbc.timeBetweenEvictionRunsMillis: 30000 sonar.notifications.delay=60
执行 bin/linux-x86-64/sonar.sh start 启动服务
Web访问地址:
http://sonarip:9090/
管理者:
admin/admin
Sonar for Maven的配置:
<profile> <id>sonar</id> <activation> <activeByDefault>true</activeByDefault> </activation> <properties> <sonar.jdbc.url>jdbc:mysql://10.10.18.108:3306/sonar?useUnicode=true&characterEncoding=utf8</sonar.jdbc.url> <sonar.jdbc.driver>com.mysql.jdbc.Driver</sonar.jdbc.driver> <sonar.jdbc.username>sonar</sonar.jdbc.username> <sonar.jdbc.password>sonar</sonar.jdbc.password> <sonar.host.url>http://10.10.18.108:9090</sonar.host.url> </properties> </profile>
执行mvn sonar:sonar