13
votes

After upgrading my POMs to sonar-maven-plugin:2.7 the configuration does not work any more. My configuration in settings.xml is like this:

<profile>
  <id>sonar</id>
  <properties>
    <sonar.jdbc.url>jdbc:postgresql://my.server:5432/sonar</sonar.jdbc.url>
    <sonar.jdbc.driverClassName>org.postgresql.Driver</sonar.jdbc.driverClassName>
    <sonar.jdbc.username>xxxxx</sonar.jdbc.username>
    <sonar.jdbc.password>yyyyy</sonar.jdbc.password>
    <sonar.host.url>http://my.server</sonar.host.url>
  </properties>
</profile>

The build is started with -Psonar of course. With version 2.6 everything is fine, with 2.7 I get

[INFO] --- sonar-maven-plugin:2.7:sonar (default-cli) @ myproject ---
[INFO] User cache: C:\Users\me\.sonar\cache
[ERROR] SonarQube server 'http://localhost:9000' can not be reached
...
[ERROR] Failed to execute goal org.codehaus.mojo:sonar-maven-plugin:2.7:sonar (default-cli) on project myproject: Fail to download libraries from server: java.net.ConnectException: Connection refused: connect -> [Help 1]

Starting the build with -X gives me the correct mojo configuration in both cases, especially the url is still correct in the log

[DEBUG]   (f) sonarHostURL = http://my.server

Even deleting the mentioned caching directory does not help.

What can I do except of managing the plugin to version 2.6?

6
I can confirm this error. My sonarqube buildplans stoped working this morning. - heldt
Same for me. Did anyone already filed a bug? - daniel.eichten
The process to raise a bug seems to be post a message on the google groups forum so that is what I have done : groups.google.com/forum/#!topic/sonarqube/FSAkrB9pzOY - Kevin Cross
FYI Now there is a 2.7.1 version of the plugin where the bug is fixed. - Redlab

6 Answers

10
votes

Workaround: Adding -Dsonar.host.url=http://my.server:9000 to mvn command works for me

11
votes

We are investigating the issue. Ticket was created: https://jira.sonarsource.com/browse/MSONAR-129

In the meantime you could either lock the SQ plugin to version 2.6 or pass all properties using command line.

3
votes

Better than disabling the plugin, you may fix the plugin version to 2.6, which works fine, taking into account sonar.host.url.

For instance, with Maven in my case:

<pluginManagement>
  </plugins>
    <plugin>
      <groupId>org.codehaus.mojo</groupId>
      <artifactId>sonar-maven-plugin</artifactId>
      <version>2.6</version>
      <!-- sonar.host.url not working with version 2.7 -->
    </plugin>
  </plugins>
</pluginManagement>
2
votes

I use the full qualified goal in the CI server to run the sonar goals:

mvn org.codehaus.mojo:sonar-maven-plugin:2.6:sonar

Since we use the templates in TeamCity this is not so much of a disaster. Still we were a bit surprised by the event.

0
votes

Both

mvn -Dsonar.host.url=http://localhost:9000 org.codehaus.mojo:sonar-maven-plugin:2.6:sonar

and

mvn -Dsonar.host.url=http://localhost:9000 org.sonarsource.scanner.maven:sonar-maven-plugin:3.2:sonar

worked for me :

enter image description here

-3
votes

Instead of reconfiguring all jobs I disabled sonar for all jobs until this gets fixed. I added

<sonar.skip>true</sonar.skip>

to the sonar profile in settings.xml.