sonar.host.url not working with sonar-maven-plugin:2.7
Asked Answered
B

7

16

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?

Blemish answered 23/10, 2015 at 7:31 Comment(4)
I can confirm this error. My sonarqube buildplans stoped working this morning.Kutchins
Same for me. Did anyone already filed a bug?Goggles
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/FSAkrB9pzOYSpock
FYI Now there is a 2.7.1 version of the plugin where the bug is fixed.Eluvium
T
11

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

Thoraco answered 23/10, 2015 at 12:1 Comment(2)
Works fine for me, since we're using Teamcity templates.Blemish
Just in case if some one stumbles up on this. I had same error with latest SonarQube ( 5.5.1) . I had to use -Dsonar.host.url=http://my.server:9000/sonar - not sure what was wrong.Marbleize
C
13

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.

Ceratodus answered 23/10, 2015 at 12:22 Comment(2)
any timeline on 2.7.1 release?Gothenburg
2.7.1 has been releasedEluvium
T
11

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

Thoraco answered 23/10, 2015 at 12:1 Comment(2)
Works fine for me, since we're using Teamcity templates.Blemish
Just in case if some one stumbles up on this. I had same error with latest SonarQube ( 5.5.1) . I had to use -Dsonar.host.url=http://my.server:9000/sonar - not sure what was wrong.Marbleize
P
4

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>
Pressure answered 23/10, 2015 at 13:19 Comment(0)
A
2

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.

Agripina answered 26/10, 2015 at 7:44 Comment(0)
B
0

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

Bruckner answered 17/2, 2017 at 22:5 Comment(0)
S
0

For me, the sonar.host.url in settings.xml doesn't work even if run the command like this

mvn sonar:sonar -s settings.xml

The issue is gone until I put the same property in root pom.xml

Scrubber answered 26/7 at 3:15 Comment(0)
H
-6

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.

Hydrargyrum answered 23/10, 2015 at 10:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.