Search code examples
javamavenannotation-processing

Cannot remove java annotation processor from maven project


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.


Solution

  • 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.