Maven Plugin incompatible with new LTS release

SonarQube 8.9.0.43852 LTS
Maven Plugin 3.9.0.2155

All Java /Maven based projects are erroring out with:

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar (default-cli) on project mxServer: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar failed: An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar: java.lang.NoSuchMethodError: org.sonar.java.checks.LocaleInstanceFieldCheck.hasSemantic()Z

Hi,

To me it looks like you have a custom rules plugin in your SonarQube server, that is no more compatible with the version of the Java analyzer part of SonarQube 8.9.
Can you provide the list of plugins from your SonarQube server?

@SageSure-EdV did you get this working? I am running into the same issue. I have recently upgraded to Sonarqube version 8.9.1 and using the sonar-maven-plugin version 3.9.0.2155. It’s giving same error:

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar (default-cli) on project vap-service: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar failed: An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.7.0.1746:sonar: java.lang.NoSuchMethodError: ‘boolean org.sonar.java.checks.LocaleInstanceFieldCheck.hasSemantic()’

hello facing a similar issue

[exec] [ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar (default-cli) on project MAINTRUNK-CCAP: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar failed: An API incompatibility was encountered while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.9.0.2155:sonar: java.lang.NoSuchMethodError: org.sonar.plugins.java.api.JavaFileScannerContext.getFile()Ljava/io/File;

Hey @SageSure-EdV, @Suman_Kumar , @mtyagadurgam ,

You are all facing custom-rules incompatibilities with more recent versions of the Java analyzer custom rules API. You probably forgot to keep it up to date in your update process.

If you updated your SonarQube instance to version 8.9, you need to update the dependency of the java custom-rule plugins that are embedded to the corresponding version of the SonarSource Java Analyzer. For SQ 8.9, it is:

<sonarjava.version>6.15.1.26025</sonarjava.version>

More here: [Java Analyzer] CUSTOM RULES 101 - Looking at the pom

For changes in API and how to fix them, refer to embedded documentation: Java - Custom Rules API Changes

Cheers,
Michael

Man, it sure would be great if SonarQube had a mechanism that would update their internal plugins as expected, seeing as how “sonar-java” doesn’t exist in the file tree and “sonarjava.version” isn’t defined in any file.(/sarc)

Next thing that would be great is if the “sonar-java” plugin were actually in the “Installed Plugins” list, or heck, even in the Complete Release Notes.(/even-bigger-sarc)

All that aside, I did look at the project page - let’s just say there are issues. If I follow their recommendation, I have to build the project from code every release and manually upgrade as per non-SQ plugins.

However, the current Master branch is broken (something around Google Code wrappers not being available) and the build instructions are rather … rudimentary.

Not to mention that I have to compile with JDK 16, but it only runs with JDK 11…

So I’m at a loss as to how to actually fix this in our platform.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.