我使用javapoet编写了ProtoBufAnnotationProcessor
我已经在build.gradle
implementation group: 'com.squareup', name: 'javapoet', version: '1.11.1'
当我在另一个包含依赖项的项目中测试此批注时
<dependency>
<groupId>pers.a9043</groupId>
<artifactId>protobuf-annotation-processor</artifactId>
<version>1.0.0</version>
<optional>true</optional>
</dependency>
我发现了错误
javax.annotation.processing.Processor: Provider pers.a9043.ProtoBufAnnotationProcessor could not be instantiated: java.lang.NoClassDefFoundError: com/squareup/javapoet/xxx
我必须同时包括处理器模块和Spring Boot模块的javapoet依赖项,才能解决此错误。
但是我不想在Spring Boot模块中包含此依赖项。看起来很奇怪。