Sonar fails to connect to mySQL always tries jdbc:

2019-02-24 08:23发布

This morning I have downloaded Sonar latest version. maven 3.2.5, mysql. Sonar setup went correctly and I have the web site at 9000 working fine and all tables correctly created in mySql. I have updated my .m2/settings.xml with the following

<profiles>
  <profile>
    <id>sonar</id>
    <properties>
      <sonar.jdbc.url>jdbc:mysql://localhost:3306/sonar?useUnicode=true&amp;characterEncoding=utf8&amp;rewriteBatchedStatements=true</sonar.jdbc.url>
      <sonar.jdbc.username>myuser</sonar.jdbc.username>
      <sonar.jdbc.password>mypassword</sonar.jdbc.password>
       <sonar.host.url>http://localhost:9000</sonar.host.url>
    </properties>
  </profile>
</profiles>

I tried mvn sonar:sonar, I always get

INFO: Work directory: /home/salam/git/spring-petclinic/target/sonar
INFO: SonarQube Server 5.1
[INFO] [00:11:25.410] Load global repositories
[INFO] [00:11:26.307] Load global repositories (done) | time=905ms
[INFO] [00:11:26.317] Server id: 20150406220059
[INFO] [00:11:26.326] User cache: /home/salam/.sonar/cache
[INFO] [00:11:26.360] Install plugins
[INFO] [00:11:26.539] Install JDBC driver
[INFO] [00:11:26.554] Create JDBC datasource for jdbc:h2:tcp://localhost/sonar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE

I even updated sonnar-project.properties with

sonar.jdbc.driverClassName=com.mysql.jdbc.Driver
sonar.sourceEncoding=UTF-8
sonar.jdbc.url=jdbc:mysql://localhost:3306/sonar?useUnicode=true&amp;characterEncoding=utf8
sonar.jdbc.username=myuser
sonar.jdbc.password=mypassword 

No way, always getting the same error and sonar can not go through

I visited a couple of threads here Sonar fails to connect to database I understand that what I have doen should make this project works fine but this is not the case

Thanks for your help

1条回答
beautiful°
2楼-- · 2019-02-24 09:03

I solved it. I needed to add the following in the settings.xml

<activation>
    <activeByDefault>true</activeByDefault>
</activation>
查看更多
登录 后发表回答