JavaDoc validation with Sonarqube plugin

Hello everybody,

I am currently programming a (custom rules) plugin for Sonarqube that should validate documentation of the class. The validation-rule contains of the following points:

  • Whether documentation exists
  • Validate tags (e.g. “@tag text” must be exists)

doc example:

* This is documentation of Classname
* @tag test, test-tag

At @tag, e.g. The keyword “test, test-tag” should be checked if it`s exists and if can be found in a list of keywords. But first, I want to check first if doc is exists.

However, I am stuck with the problem that I can`t found a way to read the documentation(s) of the class. Then I found this:

With the GitHub link, I have founded the class Javadoc from and tried to use it in my plugin in the visitClass-method:

public class DocCheck extends BaseTreeVisitor implements JavaFileScanner {
public void visitClass(ClassTree tree) {
  Javadoc javadoc = new Javadoc(tree);
  if (javadoc.noMainDescription()) {
    reportIssue(this.context, this, tree, "no class description");

Junit Tests is passed, so I uploaded the Plugin on the Sonarqube-server. But after building and loading of java project that I want to scan, I got the following error:
java.lang.NoClassDefFoundError: org/sonar/java/checks/helpers/Javadoc

Possibly important: Sonarqube Version is 7.9.2.

Can someone help me with this? I hope it was understandable. Thanks in advance.


The JavaDoc class from the Java Analyzer is not available at runtime, it’s an internal helper class, which have not been exposed in our API. Unfortunately, like you mentioned, you will be able to use it in your tests, but not in production.

If you really need its features, I would recommend you to duplicate the helper class into your custom-rules plugin for the time being, as we don’t plan to expose it.


1 Like

Hi Michel,

Before I write this thread, I also have tried to duplicate the helper class into my plugin too, but the test always crash before it starts to scan and similar like I mentioned errors have occurred.

Fews hours ago, I have tried it again, with the different that the helper classes is in another package. I think I have forgotten something before but now it seems to be working. Thank you!


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.