Intellij 看不到 MapStruct 生成的 class

Intellij doesn't see the generated class by MapStruct

当我在 spring-boot 中使用 MapStruct 时,它会生成一个 impl class,我想访问该文件以在单元测试中导入,但 intellij 看不到它

@SpringBootTest(classes={OrderMapperImpl.class})

我遇到了错误

Can't find a symbol OrderMapperImpl

您可以通过右键单击目录 target/generated-sources/annotations > Mark directory as... > Generated Sources Root.

告诉 IntelliJ 将生成的映射结构 类 作为源文件

如果您配置了另一个输出路径,则需要选择它。