2

I have a Java 7/Maven 3 project that I want to use SonarQube with. Because of Java 7, I have to use the sonar-maven-plugin 3.0.2. I'm getting a 401 error when trying to connect:

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin: 3.0.2:sonar (default-cli) on project XXX: Unable to execute SonarQube: Fail to download libraries from server: Status returned by url [YYY/sonarqube/batch_bootstrap/index] is not valid: [401] -> [Help 1]

The maven plugin version is fixed in the pom.xml like this

<plugin>
  <groupId>org.codehaus.mojo</groupId>
  <artifactId>sonar-maven-plugin</artifactId>
  <version>3.0.2</version>
</plugin>

And I put the settings in the settings.xml like in the SonarQube example:

 <pluginGroups>
    <pluginGroup>org.sonarsource.scanner.maven</pluginGroup>
 </pluginGroups>
 <profiles>
    <profile>
        <id>sonar</id>
        <activation>
            <activeByDefault>true</activeByDefault>
        </activation>
        <properties>
             <sonar.host.url>YYY</sonar.host.url>
            <sonar.login>MYUSER</sonar.login>
            <sonar.password>MYPASSWORD</sonar.password>
        </properties>
    </profile>
 </profiles>

The SonarQube version I'm trying to use is 5.6. What am I missing? Why do I keep getting this error? I tried an older version (4.5.6) of SonarQube that's installed locally on my machine and that worked. The credentials I entered are definitely working for the web panel and the system is configured to accept tests even from anonymous users, although the user I'm trying at the moment is an administrator. Is this really an authentication error (due to, say, misconfiguration) or is the sonar-maven-plugin 3.0.2 unable to communicate with SonarQube 5.6?

G. Ann - SonarSource Team
  • 22,346
  • 4
  • 40
  • 76
user3676773
  • 43
  • 1
  • 6

1 Answers1

3

There are two things going on here:

  • First, sonar-maven-plugin 3.0.2 can't be used with SonarQube 5.6
  • Second, SonarQube 5.6+ requires Java 8.

So compile your project with whatever you like, but unpin the plugin version and run the analysis with Java 8.

G. Ann - SonarSource Team
  • 22,346
  • 4
  • 40
  • 76
  • Thanks for your feedback. I unpinned the plugin version, switched to JAVA8 of course and I'm now facing the following error: [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin: 3.2:sonar (default-cli) on project YYY: Unable to execute SonarQube: Fail to download libraries from server: Status returned by url [https://XXX] is not valid: [401] -> [Help 1] Using the same (admin!) credentials to login in the browser works, force authentication is even set to false. – user3676773 Jan 04 '17 at 13:03
  • That's a new question user3676773 :-) – G. Ann - SonarSource Team Jan 04 '17 at 14:09