Cannot resole symbol: generated sources by immutables (Maven)
Hello,
I have a multi-module project maven. In one of these modules, some source code is being generated by immutables.
The source folder of the generated source ode (in `target/generated-sources`) is correctly identified by Intellij as a “sources root”. However the generated class is underlined red inside my code, with the error: “Cannot resole symbol”.
Intellij offers to solve the problem by “importing class”, which adds the package name locally to the class name, inside my code(e.g., “com.mydomain.MyClass myclass = com.mydomain.MyClass()”
I've seen some posts about this kind of problem, but seems all the suggestions are already being followed:
- source root folder is identified
- Intellij knows where the class is
- Annotation Processors is enabled and pointing at the right folders
- Reload IDE, and POM; delete cache
What should I check, or how can I fix this?
请先登录再写评论。
Hello!
Thank you for reporting this!
Can you please post the exact error message you are getting (as IDEA displays it), if possible attach a screenshot.
If you could also share a sample reproducer Project, that would be very helpful for the investigation as well.
The exact message is a compiling error “Cannot resolve symbol” that hoover over a red typed class.
Thank you for the update!
Unfortunately, issues, that involve annotation processors can be tricky to investigate, so I would highly appreciate if you could share the Project you're working on (or a sample Project that exhibits the same behavior) along with IDEA logs (Help → Collect Logs and Diagnostic Data), so we can determine the root cause of the issue.