title: Bad service configuration file, or exception thrown while constructing Processor object
body: <p>I am writing a simple custom annotation in Java and running into a problem with it. Here is the main parts of my code. </p>
  
  <p><strong>LogMeCustomAnnotation.java</strong></p>
  
  <pre><code>package fun.n.learn.annotation;
  
  import java.lang.annotation.Retention;
  import java.lang.annotation.RetentionPolicy;
  
  // We need this annotation only till before compilation.
  @Retention(RetentionPolicy.SOURCE)
  // This is a simple custom annotation.
  public @interface LogMeCustomAnnotation {
  
  }
  </code></pre>
  
  <p><strong>LogMeCustomAnnotationProcessor.java</strong></p>
  
  <pre><code>package fun.n.learn.annotation;
  
  import java.util.Set;
  
  import javax.annotation.processing.AbstractProcessor;
  import javax.annotation.processing.Messager;
  import javax.annotation.processing.RoundEnvironment;
  import javax.annotation.processing.SupportedAnnotationTypes;
  import javax.lang.model.element.TypeElement;
  import javax.tools.Diagnostic;
  
  // List the custom annotations that are supported.
  @SupportedAnnotationTypes({ "fun.n.learn.annotation.LogMeCustomAnnotation" })
  // Extend AbstractProcessor. This will let you process.
  public class LogMeCustomAnnotationProcessor extends AbstractProcessor {
  
      @Override
      public boolean process(Set&lt;? extends TypeElement&gt; annotations,
              RoundEnvironment roundEnv) {
  
          Messager messager = processingEnv.getMessager();
          messager.printMessage(Diagnostic.Kind.NOTE, "I was here.");
  
          // TODO: Put some meaningful code here. Right now just get it to work.
  
          // return false;
          // We have already handled these annotations. No more. So return true.
          return true;
      }
  
  }
  </code></pre>
  
  <p><strong>/src/main/resources/META-INF/services/javax.annotation.processing.Processor</strong></p>
  
  <pre><code>fun.n.learn.annotation.LogMeCustomAnnotationProcessor
  </code></pre>
  
  <p><strong>pom.xml</strong></p>
  
  <pre><code>&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;fun.n.learn&lt;/groupId&gt;
      &lt;artifactId&gt;javaCustomAnnotation&lt;/artifactId&gt;
      &lt;version&gt;0.1.0&lt;/version&gt;
  
      &lt;build&gt;
          &lt;plugins&gt;
              &lt;plugin&gt;
                  &lt;!-- Configure the project to use java 8 version. --&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;!-- Disable annotation processing for ourselves. --&gt;
                      &lt;!-- &lt;compilerArgument&gt;-proc:none&lt;/compilerArgument&gt; --&gt;
                  &lt;/configuration&gt;
              &lt;/plugin&gt;
          &lt;/plugins&gt;
      &lt;/build&gt;
  
  
  &lt;/project&gt;
  </code></pre>
  
  <p>Now when I run <code>mvn -e clean install</code> I get the following problem </p>
  
  <pre><code>[ERROR] COMPILATION ERROR : 
  [INFO] -------------------------------------------------------------
  [ERROR] Bad service configuration file, or exception thrown while constructing Processor object: javax.annotation.processing.Processor: Provider fun.n.learn.annotation.LogMeCustomAnnotationProcessor not found
  [INFO] 1 error
  </code></pre>
  
  <p>I must be missing a simple trick here. Any help? </p>