我正在使用谷歌AutoFactory的注释处理器.我注释SomeClass与@AutoFactory和引用的new SomeClassFactory().create()是同一个模块在其他地方.
我在Maven中添加了必要的依赖:
<dependency>
<groupId>com.google.auto.factory</groupId>
<artifactId>auto-factory</artifactId>
<version>1.0-beta2</version>
<optional>true</optional>
</dependency>
Run Code Online (Sandbox Code Playgroud)
运行时,$ mvn clean compile我看到它target/generated-sources/annotions/somepackage/SomeClassFactory已创建,模块编译没有错误.
Reimport all maven modulesPreferences- > Annotation Processors- >Enable annotation processingRebuild Projectv14.1.4如果我的理解是正确的,那么在我的IDEA()版本中这应该足够了.
我还执行了以下步骤:
generated-sources文件夹已添加为源Project StructureGenerated sources folders已设置为Detect automaticallytarget首先删除文件夹以确保它是由IntelliJ生成的)Exclude output paths按照@tilpner的建议在项目结构中禁用.idea文件夹和.iml文件Phase to be used for …