How can be solved java.lang.NoClassDefFoundError: javax/annotation/Generated? : <p>I`ve changed jdk to a 9 version in my project and then collided with an error :</p>

<pre><code>Error:java: java.lang.NoClassDefFoundError: javax/annotation/Generated
</code></pre>

<p>I try to solve it by the adding following to pom.com but it wasn`t work for me: </p>

<pre><code>&lt;plugin&gt;
   &lt;groupId&gt;org.apache.maven.plugins&lt;/groupId&gt;
   &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
   &lt;version&gt;${version.compiler.plugin}&lt;/version&gt;
   &lt;configuration&gt;
       &lt;!-- fork is needed so compiler args can be used --&gt;
       &lt;fork&gt;true&lt;/fork&gt;
       &lt;compilerArgs&gt;
           &lt;arg&gt;-J--add-modules&lt;/arg&gt;
           &lt;arg&gt;-Jjava.annotations.common&lt;/arg&gt;
       &lt;/compilerArgs&gt;
   &lt;/configuration&gt;
&lt;/plugin&gt;
</code></pre>

<p>Does it have other way to solve? </p>
