title: Javac - plugin not found
body: <p>I am trying to make my own Javac plugin but things aren't going so well already :( I am following this tutorial: <a href="https://www.baeldung.com/java-build-compiler-plugin" rel="nofollow noreferrer">https://www.baeldung.com/java-build-compiler-plugin</a> and when I want to test the first basic plugin it can't find it. </p>
  
  <p>When I enter the following command: </p>
  
  <blockquote>
    <p>javac -cp ./target/classes/javacplugin/ -Xplugin:Getter ./src/main/java/javacPlugin/App.java</p>
  </blockquote>
  
  <p>I get this error:</p>
  
  <blockquote>
    <p>plug-in not found: Getter</p>
  </blockquote>
  
  <p>How do I solve this issue?</p>
  
  <p>This is my sourcetree:</p>
  
  <p><a href="https://i.stack.imgur.com/8TFg6.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/8TFg6.png" alt="enter image description here"></a></p>
  
  <p>This is my code for the plugin:</p>
  
  <pre><code>package javacplugin;
  
  import com.sun.source.util.JavacTask;
  import com.sun.source.util.Plugin;
  import com.sun.tools.javac.api.BasicJavacTask;
  import com.sun.tools.javac.util.Context;
  import com.sun.tools.javac.util.Log;
  
  /**
   * JavacPlugin
   */
  public class JavacPlugin implements Plugin {
  
      @Override
      public String getName() {
          return "Getter";
      }
  
      @Override
      public void init(JavacTask task, String... arg1) {
          Context context = ((BasicJavacTask) task).getContext();
          Log.instance(context).printRawLines(Log.WriterKind.NOTICE, "Hello from " + getName());
  
      }    
  }
  </code></pre>
  
  <p>This is what's inside of <code>com.sun.source.util.Plugin</code>:</p>
  
  <pre><code>javacplugin.JavacPlugin
  </code></pre>
  
  <p>This is my pom.xml:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  
  &lt;project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"&gt;
    &lt;modelVersion&gt;4.0.0&lt;/modelVersion&gt;
  
    &lt;groupId&gt;javacplugin&lt;/groupId&gt;
    &lt;artifactId&gt;javacplugin&lt;/artifactId&gt;
    &lt;version&gt;1&lt;/version&gt;
  
    &lt;name&gt;javacplugin&lt;/name&gt;
    &lt;!-- FIXME change it to the project's website --&gt;
    &lt;url&gt;http://www.example.com&lt;/url&gt;
  
    &lt;properties&gt;
      &lt;project.build.sourceEncoding&gt;UTF-8&lt;/project.build.sourceEncoding&gt;
      &lt;maven.compiler.source&gt;1.8&lt;/maven.compiler.source&gt;
      &lt;maven.compiler.target&gt;1.8&lt;/maven.compiler.target&gt;
    &lt;/properties&gt;
  
    &lt;dependencies&gt;
      &lt;dependency&gt;
        &lt;groupId&gt;com.sun&lt;/groupId&gt;
        &lt;artifactId&gt;tools&lt;/artifactId&gt;
        &lt;version&gt;1.8.0&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;dependency&gt;
        &lt;groupId&gt;junit&lt;/groupId&gt;
        &lt;artifactId&gt;junit&lt;/artifactId&gt;
        &lt;version&gt;4.11&lt;/version&gt;
        &lt;scope&gt;test&lt;/scope&gt;
      &lt;/dependency&gt;
    &lt;/dependencies&gt;
  
    &lt;build&gt;
      &lt;pluginManagement&gt;&lt;!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) --&gt;
        &lt;plugins&gt;
          &lt;!-- clean lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#clean_Lifecycle --&gt;
          &lt;plugin&gt;
            &lt;artifactId&gt;maven-clean-plugin&lt;/artifactId&gt;
            &lt;version&gt;3.1.0&lt;/version&gt;
          &lt;/plugin&gt;
          &lt;!-- default lifecycle, jar packaging: see https://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_jar_packaging --&gt;
          &lt;plugin&gt;
            &lt;artifactId&gt;maven-resources-plugin&lt;/artifactId&gt;
            &lt;version&gt;3.0.2&lt;/version&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
            &lt;artifactId&gt;maven-compiler-plugin&lt;/artifactId&gt;
            &lt;version&gt;3.8.0&lt;/version&gt;
            &lt;configuration&gt;
              &lt;compilerArgs&gt;
                &lt;arg&gt;-Xplugin:Getter&lt;/arg&gt;
              &lt;/compilerArgs&gt;
            &lt;/configuration&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
            &lt;artifactId&gt;maven-surefire-plugin&lt;/artifactId&gt;
            &lt;version&gt;2.22.1&lt;/version&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
            &lt;artifactId&gt;maven-jar-plugin&lt;/artifactId&gt;
            &lt;version&gt;3.0.2&lt;/version&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
            &lt;artifactId&gt;maven-install-plugin&lt;/artifactId&gt;
            &lt;version&gt;2.5.2&lt;/version&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
            &lt;artifactId&gt;maven-deploy-plugin&lt;/artifactId&gt;
            &lt;version&gt;2.8.2&lt;/version&gt;
          &lt;/plugin&gt;
          &lt;!-- site lifecycle, see https://maven.apache.org/ref/current/maven-core/lifecycles.html#site_Lifecycle --&gt;
          &lt;plugin&gt;
            &lt;artifactId&gt;maven-site-plugin&lt;/artifactId&gt;
            &lt;version&gt;3.7.1&lt;/version&gt;
          &lt;/plugin&gt;
          &lt;plugin&gt;
            &lt;artifactId&gt;maven-project-info-reports-plugin&lt;/artifactId&gt;
            &lt;version&gt;3.0.0&lt;/version&gt;
          &lt;/plugin&gt;
        &lt;/plugins&gt;
      &lt;/pluginManagement&gt;
    &lt;/build&gt;
  &lt;/project&gt;
  </code></pre>