IntelliJ在同一模块中使用时找不到生成的源
我正在使用Google 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>
运行时,我看到它已创建,并且模块编译没有错误。$ mvn clean compile
target/generated-sources/annotions/somepackage/SomeClassFactory
IntelliJ configuration:
Reimport all maven modules
-
Preferences
->Annotation Processors
->Enable annotation processing
Rebuild Project
如果我的理解是正确的,那么在我的IDEA版本()中,这应该足够了。v14.1.4
我还执行了以下步骤:
- 已验证是否将文件夹添加为源
generated-sources
Project Structure
- 已验证 Maven 首选项是否设置为
Generated sources folders
Detect automatically
- 已验证源代码是否确实在重建时生成(首先删除文件夹以确保它是由IntelliJ生成的)
target
- 尝试在项目结构中禁用,如@tilpner建议的那样
Exclude output paths
- 使缓存失效并重新启动
- 删除文件夹和文件
.idea
.iml
- 试验 in 的不同设置
Phase to be used for folders update
Preferences
->Maven
->Importing
问题:
执行所有这些步骤后,生成的类不会显示在项目资源管理器中。事实上,整个目录无处可见。编译失败,并在编辑器中标记为红色,而Maven生成和编译没有任何问题。target
cannot find symbol: SomeClassFactory
new SomeClassFactory().create()
我自己没有选择,任何帮助或建议都非常受欢迎!
更新:当我注释导致编译错误的代码时,IntelliJ在编译消息中打印此警告:Warning:Output path /Users/.../target/generated-sources/annotations intersects with a source root. Only files that were created by build will be cleaned.