How to get rid of duplicate class errors in Intellij for a Mavenized project using Lombok : <p>I have a Maven managed Lombok project and I use Intellij. After building, I always get lots of errors in Intellij about duplicate classes because of the generated sources in target/generated-sources/delombok. Is there something I can do to git rid of these errors? Right now I just delete the target folder, but this is really irritating to have to do.</p>

<p>I have the standard configuration in Maven and the lombok source code in is in main/src/lombok:</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;3.5.1&lt;/version&gt;
            &lt;configuration&gt;
                &lt;source&gt;1.8&lt;/source&gt;
                &lt;target&gt;1.8&lt;/target&gt;
                &lt;encoding&gt;UTF-8&lt;/encoding&gt;
            &lt;/configuration&gt;
        &lt;/plugin&gt;

        &lt;plugin&gt;
            &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;
            &lt;artifactId&gt;lombok-maven-plugin&lt;/artifactId&gt;
            &lt;version&gt;1.16.8.0&lt;/version&gt;
            &lt;executions&gt;
                &lt;execution&gt;
                    &lt;phase&gt;generate-sources&lt;/phase&gt;
                    &lt;goals&gt;
                        &lt;goal&gt;delombok&lt;/goal&gt;
                    &lt;/goals&gt;
                &lt;/execution&gt;
            &lt;/executions&gt;
        &lt;/plugin&gt;

  &lt;profiles&gt;
    &lt;profile&gt;
        &lt;id&gt;lombok-needs-tools-jar&lt;/id&gt;
        &lt;activation&gt;
            &lt;file&gt;
                &lt;exists&gt;${java.home}/../lib/tools.jar&lt;/exists&gt;
            &lt;/file&gt;
        &lt;/activation&gt;
        &lt;build&gt;
            &lt;plugins&gt;
                &lt;plugin&gt;
                    &lt;groupId&gt;org.projectlombok&lt;/groupId&gt;
                    &lt;artifactId&gt;lombok-maven-plugin&lt;/artifactId&gt;
                    &lt;version&gt;1.16.8.0&lt;/version&gt;
                    &lt;dependencies&gt;
                        &lt;dependency&gt;
                            &lt;groupId&gt;sun.jdk&lt;/groupId&gt;
                            &lt;artifactId&gt;tools&lt;/artifactId&gt;
                            &lt;version&gt;1.8&lt;/version&gt;
                            &lt;scope&gt;system&lt;/scope&gt;
                            &lt;systemPath&gt;${java.home}/../lib/tools.jar&lt;/systemPath&gt;
                        &lt;/dependency&gt;
                    &lt;/dependencies&gt;
                &lt;/plugin&gt;
            &lt;/plugins&gt;
        &lt;/build&gt;
    &lt;/profile&gt;
&lt;/profiles&gt;
</code></pre>
