Required class was missing org.sonarsource.scanner.maven:sonar-maven-plugin:3.11.0.3922

  • Upgraded sonarqube from 8.9 to 10.5.1, all the pipelines working with 8.9 fail with upgraded version, also tried various versions of sonar scanner and even tried to test. Even tested with various projects form here GitHub - SonarSource/sonar-scanning-examples: Shows how to use the Scanners every projects throws the same error.

  • Exact log:
    Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.10.0.2594:sonar (default-cli) on project sonarscanner-maven-multilingual: Execution default-cli of goal org.sonarsource.scanner.maven:sonar-maven-plugin:3.10.0.2594:sonar failed: A required class was missing while executing org.sonarsource.scanner.maven:sonar-maven-plugin:3.10.0.2594:sonar: org/sonar/plugins/java/api/CheckRegistrar

Welcome :slight_smile:

SonarQube 10.5 brought changes to plugin loading and dependency management.
Do you use a plugin with custom rules or a thirdparty / community plugin ?

Gilbert

1 Like

Yes we do have 4 plugins installed
AEM Rules for SonarQube
Ansible Lint
Cobertura
Code Smells

If there ain’t no current release for those plugins, they all might not be compatible with Sonarqube 10.5.x

You may try with rename one to xxx.jar_ then restart Sonarqube and see if your maven build runs, then repeat with the others.

uninstalling the plugins worked. What is the workaround specifically for using " AEM Rules for SonarQube" on 10.5.1 version?

There is no workaround to make it work with Sonarqube 10.5.1.
The plugin needs to be completely reworked to be able to use it with a new Sonarqube version,
there are api and dependency changes.

According to the Github project

nothing has happened here for quite some time.
There are 28 open issues, i.e.
Make "AEM-Rules-for-SonarQube" compatible with SonarQube 10.4 "DownloadOnlyWhenRequired" feature · Issue #240 · wttech/AEM-Rules-for-SonarQube · GitHub from February 2024

You can try to create a new issue or a pull request with the necessary adjustments.
Otherwise this project has Apache 2.0 license, maybe you can fork (i’m no license expert) and create a new version by yourself !?

I had the exact same issue. Uninstalling the plugin unblocked me. But now i am running in to an new issue where sonar scanner is treating a content-package of maven as a java project and failing.

[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:4.0.0.4121:sonar (default-cli) on project <project-code>: Can not execute Findbugs: One (sub)project contains Java source files that are not compiled (/Users/himanshu.pathak/work/code/<project-code>/content).
[ERROR] sonar.java.binaries was set to /Users/himanshu.pathak/work/code/<project-code>/content/target/classes
[ERROR] Sonar JavaResourceLocator.classFilesToAnalyze was empty
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command

The content package has below definition. How can i tell scanner to not to treat this as a java project?

    <packaging>content-package</packaging>


If content-package has its own pom use

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

otherwise

<properties>
  <sonar.exclusions>**/content-package/**/*</sonar.exclusions>
</properties>

Hi @anon67236913 I dont want to ignore this project from analysis. there are many HTML, JS and CSS files in this project so i want it be analyzed. The issue is that this project is being analyzed as a java project. Looks like a regression to me with 10.5.1

ok, then you might use

<properties>
  <sonar.exclusions>**/*.java</sonar.exclusions>
</properties>

It seems it’s a problem with using Findbugs !?

There is no java file in this project. May be a bug in the findbugs plugin.

you may try

<properties>
  <sonar.findbugs.skip>true</sonar.findbugs.skip>
</properties>