Scanner run error with my custom rule

the error log is “java.lang.NoClassDefFoundError: org/sonar/java/resolve/JavaSymbol$MethodJavaSymbol

in my custom rule ,i use the method in sonar-java-plugin-5.8.jar
the source code is
Symbol symbol = ((IdentifierTree) tree).symbol();
boolean isLocalVar = symbol.owner().isMethodSymbol()
_ && !(( symbol.owner()).getParameters().scopeSymbols().contains(symbol);_

there is no error in IDE,and the sonarqube can work.
should I packaged the sonar-java-plugin-5.8.jar in my custom rule jar?
and how ?


The only classes available from your custom rules are the one located in the package

All the other classes will fail to be loaded at runtime.
In your case you should use : instead of MethodJavaSymbol.