After scanning with custom rules in version 9.9, java.lang.NoClassDefFoundError: com/sun/source/tree

I think this might be a very similar issue as: Is the maven scanner forking a new JVM?

You need classes from the javac compiler module, which is not included in a JRE.
To get a JDK instead of a JRE you can disable the provisioning with: sonar.scanner.skipJreProvisioning=true