Intellij cannot resolve method but compiles and runs
已回答
This was a new installation in my spare computer in order to migrate my project from Java 10 to 12. The migration succeded and the project runs fine. However, Intellij cannot resolve methods in most of my classes. It compiles, runs and Maven does not complain. I have spent a lot of time installing and re-installing Intellij, invalidate cache and restart, deleted .idea and iml files, etc. Nothing works and still cannot resolve methods. Could you please advise.
请先登录再写评论。
Please share the screenshot of the issue, the logs (https://intellij-support.jetbrains.com/hc/articles/207241085) and the sample project to reproduce it. You can upload the files privately at https://uploads.services.jetbrains.com/. Specify the file name(s) you've uploaded so that we can find them.
Hi Serge,
I have uploaded the idea.log and a screenshot. As stated, the project compiles and runs without problems. Indeed, it is an exact copy of the project in my main pc and is downloaded from my private repository on Github. I have re-installed intellij using the toolbox this morning but the problem is still there, which is obviously frustrating as I have spent a lot of time on this. I cannot make any changes to the project using the laptop while I am on the move because Intellij does not resolve the methods. Also, please note that I have made sure that the jdk dependencies are in order in the project structure. Surely there must be a simple setting somewhere to remove the problem!!!
How does the Currency.java look like in the editor (provide a screenshot)? Where is it located in the project?
Please see screenshot below:
As you can see Intellij thinks that this class is never used, but the project compiles!!!!
OK, it appears that you are using Lombok in this project which IntelliJ IDEA doesn't support out of the box.
You need to install this plug-in: https://plugins.jetbrains.com/plugin/6317-lombok.
That is it. I have just installed the plugin and everything is fine. I should have thought about it and saved myself some pain, but that is life as a developer!!
On the plus side, I now know about the toolbox which seems very helpful.
Many thanks for your quick reply and help.
Best regards,
Sandro
However, should not Intellij complain or provide more information for the missing plugin rather than just run???
You can also use settings sync via account, this way even plug-ins will be synchronized and you will never get into this problem again after the fresh install.
https://www.jetbrains.com/help/idea/sharing-your-ide-settings.html#f30750a3
> However, should not Intellij complain or provide more information for the missing plugin rather than just run???
You can require certain plug-ins to be installed depending on the project: https://www.jetbrains.com/help/idea/settings-required-plugins.html .
Thanks, I had forgotten about that functionality.
THANK YOU SO MUCH, I run into this issue and I knew there was dynamic stuff not being understandable by the IDE and then I found out this thread with this module resolver and it makes my Intellisense works!
I too faced the similar issue and installing lombok solved it.Thankyou verymuch