403 after upgrading sonar-maven-plugin to 5.0.0.4389

Hi

with a local SonarQube (community 9 lts), I was correctly running mvn sonar:sonar with the SONAR_TOKEN environment variable correctly set. I was using

         <plugin>
           <groupId>org.sonarsource.scanner.maven</groupId>
           <artifactId>sonar-maven-plugin</artifactId>
          <version>4.0.0.4121</version>
         </plugin>

After updating to <version>5.0.0.4389</version>, the sonar:sonar goal always fails with

Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:5.0.0.4389:sonar (default-cli) on project ...: Error status returned by url [https://api.sonarcloud.io/analysis/jres?os=linux&arch=x86_64]: 403

Reverting to the previous version of the Maven plugin makes it work again.

Is that a known regression?

Thanks in advance

Hey @LorenzoBettini

It looks like the Scanner for Maven is defaulting to connecting to SonarQube Cloud.

Are you specifying sonar.host.url? I suggest making sure it points to your local SonarQube instance.

Hi @Colin

I confirm that specifying sonar.host.url to point to http://localhost:9000 makes it work again. Thanks!

I’m a bit surprised that such a breaking change is not part of the release record of the scanner plugin unless I missed it.

I agree with you, but I’m honestly not sure where we would put it. Let me poke around on that.

Well, if you ask me, that’s be a great place: Release 5.0.0.4389 · SonarSource/sonar-scanner-maven · GitHub

I’d also highlight that as a “breaking change” :wink: