I have a JDK 1.7 project with a maven dependency to a local jar in my maven repo.
I'm unable to build the project using Intellij, with the errors that a symbol cannot be found (the symbol is a class importing packages from the local jar)
But I can successfully build the project using 'mvn package'.
I've spent so much time looking for solutions, things I've already done:
- Invalidated cache
- 'mvn clean install' the local jar dependecy
- Marked to 'autoload snapshots' in Intellij's maven configuration
- Reimpoted maven in Intellij
- Syncornized
This error happend to my couple of times before, but usually just closing the Intellij and /or doing the 'mvn clean install' did the trick.
Please help.
Adding some more tips since this is the first thing that came up in the search when I was having similar problems (project builds in mvn, not in IntelliJ), in case it might help someone else.
When I had this it was a different fix on Windows and Mac.
On Mac, I went into ItellijIDEA / Preferences / Build, Execution, Deployment / Build Tools / Maven / Maven Home Directory and set it to use my separately installed Maven rather than the bundled Maven. All the build problems went away.
On Windows, I was seeing exceptions in the idea.log related to SSL and my project tree had only Java under the External Libraries branch. From looking at other sites it sounds like IntelliJ uses its own private JDK instead of the system one (even though in my case I already had the exact same JDK version installed). My system JDK has certs installed in the keystore for the corporate Nexus server that the IntelliJ private JDK didn't have, so exceptions were being thrown when it tried to get files from Nexus. For this the solution was to quit IntelliJ, set an environment variable called IDEA_JDK to point to the JDK I already had installed that had the proper certs and restart IntelliJ. All the build problems went away.
Try to delete all .iml and your POM. Then copy and paste your POM again to your project and re-open and re-import it.
If you are using gradle , try below command.This resolved my issue
gradle cleanIdea idea
I tried everything above with no joy. However I did one thing that finally got it to work:
I went to C:\Users\.IntellijJIdea2018.2 and just deleted the entire folder.
It removes all the settings and cache for IntelliJ. I had to reimport my project from scratch but a simple remove and reimport hadn't worked before, but this finally got it working again.