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()
_ && !((org.sonar.java.resolve.JavaSymbol.MethodJavaSymbol) 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 ?

Hi,

The only classes available from your custom rules are the one located in the package org.sonar.java.plugins.api

All the other classes will fail to be loaded at runtime.
In your case you should use : org.sonar.plugins.java.api.semantic.Symbol.MethodSymbol instead of MethodJavaSymbol.