-1

I'm about to refactor my dirty annotation processor. Therefore I wanted to create a new one to extract some responsibilities from the old one.

old: com.company.coma.shared.annotation.ComaToolAnnotationProcessor
new: com.company.coma.shared.annotation.ToolProcessor

Now I have removed the old one from the Configuration in my pom.xml

pom.xml

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.5.1</version>
        <configuration>
            <generatedSourcesDirectory>
                ${project.build.directory}/generated-sources/
            </generatedSourcesDirectory>
            <annotationProcessors>
                <annotationProcessor>
                    com.company.coma.shared.annotation.ToolProcessor
                </annotationProcessor>
                <!--<annotationProcessor>-->
                    <!--com.company.coma.shared.annotation.ComaToolAnnotationProcessor-->
                <!--</annotationProcessor>-->
            </annotationProcessors>
            <source>1.8</source>
            <target>1.8</target>
        </configuration>
    </plugin>

I also removed the ComaToolAnnotationProcessor.java file completely and rebuild the whole project afterwards.

Still this is what my clean install

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.5.1:compile (default-compile) on project module-foo: Compilation failure
[ERROR] Annotation processor 'com.company.coma.shared.annotation.ComaToolAnnotationProcessor' not found

What is going on here? How can it still look for this even when I removed any namings of it from the whole project?

EDIT#1: Deactivating the whole annotation processing plugin (maven-compiler) did not help either. I don't understand what is going on. It seems like I have not influence to the dependencies or configurations anymore.

xetra11
  • 7,671
  • 14
  • 84
  • 159

2 Answers2

0

Probably you have (manually or not) added the processor to your META-INF/services file. Therefore it will try to run it, and fail upon not finding the class specified. I believe removing the reference might fix the problem :)

Luan Nico
  • 5,376
  • 2
  • 30
  • 60
  • Sadly I have not produced any META-INF folder since the compilation does not succeed – xetra11 Dec 31 '17 at 14:40
  • If you are using maven, I think you can have a META-INF folder in you src folder, that will be copied when compiled. Probably not the case, though. – Luan Nico Dec 31 '17 at 14:55
0

I found the problem. I renamed one of my parent modules lately. But the submodules which actually contained the files to be processed still referred to the old parent artifact. That way all of my configuration of the thought to be new parent did not affected anything. Pretty weird since the the old parent module disappeared completely from my project structure but it surely was still available in my maven repo for sure.

I relied to much on the module-name refactoring feature of my IDE.

xetra11
  • 7,671
  • 14
  • 84
  • 159