The SonarQube Erroraway plugin uses errorprone and some of its plugins to detect potential bugs in java code.
I have a been using the plugin in production for 3 years and would like to ask for its inclusion in the marketplace.
Under the hood errorprone uses a restricted javac API, the analyzer must therefore run with JVM options allowing access to the API as documented here.
auto-provisioning of a JRE must be disabled because the plugin needs to run with a JDK (so it can use javac): -Dsonar.plugins.downloadOnlyRequired=false
The bureaucratic requirements look fine, and server startup with the plugin on board looks good.
However, looking at the documentation, I’m concerned about this:
In SonarQube 10.5 the new feature to only download required plugins causes a NoClassDefFoundError. The workaround for this issue is to enable the sonar.plugins.downloadOnlyRequired option on the server AND on the analyzer: -Dsonar.plugins.downloadOnlyRequired=false
This is not acceptable. Before I test, I’ll need you to update the plugin to be fully compatible with downloadOnlyRequired.
Additionally, can you help me understand the need for this, please?
From SonarQybe 10.6 the scanner also auto provisions a JRE and runs the analysis off that JVM. Since the JRE does not include the required compiler module, this needs to be disabled with sonar.scanner.skipJreProvisioning=true .
And finally, once you’ve updated the plugin, please provide the command I should use to analyze your sample project.
sonar.scanner.skipJreProvisioning=true is needed because errorprone uses javac internally (more precisely it uses the jdk.compiler module). This is not included in a JRE distribution, it needs a JDK.
IMO this is not a big problem for java projects because they’re most likely built with a JDK already.
[INFO] 11:27:03.074 Sensor Errorprone sensor [errorawaysonar]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 5.167 s
[INFO] Finished at: 2025-05-12T11:27:03-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.sonarsource.scanner.maven:sonar-maven-plugin:4.0.0.4121:sonar (default-cli) on project simple: The nullaway.annotated.packages option must be set when the NullAway rule is enabled -> [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
Since the URL exists as a link in the rule description, I think removing the URL from the issue message would do the user a big favor in terms of readability.
With 522 rules added by your plugin, I recognize that getting the actual rule descriptions into the plugin could be a lot of work, but it would be a huge benefit to the user.
it seems that the issue above is a FP? This is an import of java.util. The class isn’t being declared in java.util. I recognize that you probably didn’t write the rule implementation, but…at least turn this one off by default? Or… something?
Let me know if you plan to move on these things, and we’ll go from there.
The plugin converts the errorprone rules descriptions into sonarqube rules, it is merely converting them from markup to html. I think it is a bit beyond the scope of the project to edit these descriptions.
For this particular issue I agree that the description is a bit short. I think it expects a package declaration at the first line, where there currently is an import declaration.
So it should be:
Hello Ann, is it OK to change the proposed plugin key to errorawaysonar to match the current manifest?
This should facilitate things for users who have installed the plugin manually