We are currently using
- SonarQube Server Community Edition Version 8.1.0.31237
- Sonar Java Code Analyzer 6.3.2.22818
running on a Debian Linux 4.9.0 OS.
We have developed some custom rules based on the Java Code Analyzer.
As we are considering to update the SonarQube Server to Version 8.6, I tried to compile our custom rules plugin with the following Sonar API and Sonar Java rules versions, which are the latest versions according to Maven cetral:
<sonar.plugin.api.version>8.6.0.39681</sonar.plugin.api.version>
<java.plugin.version>6.11.0.24617</java.plugin.version>
Whe I compile the plugin with this configuration the following exception occurs when running the tests:
java.lang.NoSuchMethodError: org.sonar.api.batch.sensor.internal.SensorContextTester.setSettings(Lorg/sonar/api/config/Settings;)Lorg/sonar/api/batch/sensor/internal/SensorContextTester;
at org.sonar.java.testing.InternalCheckVerifier.sonarComponents(InternalCheckVerifier.java:551)
at org.sonar.java.testing.InternalCheckVerifier.verifyAll(InternalCheckVerifier.java:204)
at org.sonar.java.testing.InternalCheckVerifier.verifyIssues(InternalCheckVerifier.java:164)
at de.empic.sonar.EapRuleVerifier.verify(EapRuleVerifier.java:32)
at de.empic.sonar.rule.AvoidSpecificCDIBeanNameTest.detected(AvoidSpecificCDIBeanNameTest.java:10)
...
Whe I use the API version 8.2.0.32929, which is mentioned in the guide Writing Custom Java Rules 101, everything works fine. Any version higher than that, leads to the exception above.
That raises the following questions for me:
Is it possible to deploy an run the custom rules plugin having the code dependency on API version 8.2.0.32929 on a SonarQube Server with version 8.6?
When I scanned the server release upgrade notes, I found the following statement in Release 8.5:
Upgrade simplified: Languages, GIT and SVN support now built-in
Languages provided with your edition and support for GIT and SVN version control are now built-in and don’t require plugins. If you were using these plugins, you need to remove them from SonarQube before upgrading.
- Does this require changes in how I have to develop, build and deploy our custom java rules?
- How do I know, which version of the java analyzer is bundled with the SonarQube server version?