xp搭建sonar

1.http://www.sonarsource.org/downloads/下载sonar,解压到F:\sonar-2.14
2.加数据库和用户
create database sonar;
grant all on sonar.* to sonar@'localhost' identified by 'sonar';
3.修改配置F:\sonar-2.14\conf\sonar.properties
注释这句
#sonar.jdbc.url:                            jdbc:derby://localhost:1527/sonar;create=true

sonar.jdbc.url:                            jdbc:mysql://localhost:3306/sonar?useUnicode=true&characterEncoding=utf8&rewriteBatchedStatements=true
sonar.jdbc.driverClassName:                com.mysql.jdbc.Driver
sonar.jdbc.validationQuery:                select 1
4.修改maven的配置setting.xml
加上
<profile>
    <id>sonar</id>
    <activation>
<activeByDefault>true</activeByDefault>
    </activation>
    <properties>
<!-- mysql -->
<sonar.jdbc.url>
  jdbc:mysql://localhost:3306/sonar?useUnicode=true&amp;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>
<!-- remote host -->
<sonar.host.url>http://localhost:9000</sonar.host.url>
    </properties>
</profile>
5设置项目的主pom.xml
要加上
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
其中的UTF-8按需修改。
6.启动: 运行F:\sonar-2.14\bin\windows-x86-32\StartSonar.bat
7.加项目:
mvn clean install
mvn sonar:sonar
官方推荐分开执行

帮助文档
http://docs.codehaus.org/display/SONAR/Documentation


出现JDBCError: Index column size too large. The maximum column size is 767 bytes.
注释路径下创建索引的脚本
sonar-2.14\war\sonar-server\WEB-INF\db\migrate

猜你喜欢

转载自jh108020.iteye.com/blog/1464115