IntellijIDEA not recognizing classes specified in Maven dependencies

后端 未结 24 1848
醉梦人生
醉梦人生 2021-01-30 12:57

I have a project in IntellijIDEA which was created with Maven. I then specified a set of dependencies and external repositories in the Pom.xml file.

The project builds

相关标签:
24条回答
  • 2021-01-30 13:00

    Might be useful to others that were still stuck like me. None of the suggested fix worked. Actually, not before I fixed my main problem which was the installation location of maven.

    In my case, I did not use the standard location. Changing that location in the maven settings (Settings/Maven/Maven home repository) did the trick.

    My 2 cents.

    0 讨论(0)
  • 2021-01-30 13:00

    Restart, Invalid caches, outside building, none worked for me.

    Only Reimport worked finally. For others sake, putting it as answer:

    Right click the project > Maven > Reimport
    
    0 讨论(0)
  • 2021-01-30 13:01

    Go to File > Settings > Build, Execution, Deployment > Build Tools > Maven and check the Maven home directory. This should be the same maven installation used for command line

    0 讨论(0)
  • 2021-01-30 13:02

    If you have any dependencies in pom.xml specific to your organisation than you need to update path of setting.xml for your project which is by default set to your user directory in Ubuntu : /home/user/.m2/settings.xml -> (change it to your apache-maven conf path)

    Go to -> intellij settings -> build,Execution, Deployement -> Build Tools -> Maven -> User settings file

    0 讨论(0)
  • 2021-01-30 13:03

    In my case the problem was that the project was in maven2 while intellj was configured for maven3. Switching to maven2 in settings solved the problem

    0 讨论(0)
  • 2021-01-30 13:03

    Right click on the pom.xml -> Add as Maven project -> Reimport

    0 讨论(0)
提交回复
热议问题