Maven找不到自定义注释处理器

时间:2018-08-03 19:58:39

标签: java maven annotations

我已经编写了简单的注释处理器,并试图在当前项目中运行它。我的pom文件是:

<?xml version="1.0" encoding="UTF-8"?>
<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">
    <modelVersion>4.0.0</modelVersion>

    <groupId>groupId</groupId>
    <artifactId>untitled1</artifactId>
    <version>1.0-SNAPSHOT</version>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.7.0</version>
                <configuration>
                    <source>8</source>
                    <target>8</target>
                    <encoding>UTF-8</encoding>
                    <annotationProcessors>
                        <annotationProcessor>
                            com.company.AnCheck
                        </annotationProcessor>
                    </annotationProcessors>
                </configuration>

            </plugin>
        </plugins>
    </build>
</project>

但是错误消息是:

[ERROR] Annotation processor 'com.company.AnCheck' not found

我还将它添加到META-INF / services / javax.annotation.processing.Processor

com.company.AnCheck

注释处理器扩展了AbstractProcessor,并存在于com.company程序包的同一项目中。

我在做什么错了?

0 个答案:

没有答案