Fixing `No plugin found for prefix 'sonar'`

If you experience issues when using the SonarScanner for Maven with the following message in your logs, you were most likely using the outdated, and unsupported, version 4.0.0.4121 of the scanner and might have missed the warnings in your analysis logs.

No plugin found for prefix 'sonar' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories ...

To fix the issue, consider upgrading the version of the scanner you use and, most importantly, locking the version of the scanner used for analysis by doing either of:

  1. Locking the version of the scanner in your build configuration to continue using mvn sonar:sonar in your pipeline.
<build>
  <pluginManagement>
    <plugins>
      <plugin>
        <groupId>org.sonarsource.scanner.maven</groupId>
        <artifactId>sonar-maven-plugin</artifactId>
        <version>version-of-the-scanner-here</version>
      </plugin>
    </plugins>
  </pluginManagement>
</build>
  1. Explicitly calling the sonar goal in your pipeline using the full coordinates of the plugin.
mvn org.sonarsource.scanner.maven:sonar-maven-plugin:version-of-the-scanner-here:sonar
1 Like