Reputation: 771
Dear Stackoverflow Community, I have the following problem with my spring boot starter application. I imported the starter project as a new maven project into IntelliJ. But IntelliJ does not find the dependencies I specified in the pom.
Image of my Application Class:
If I try to run the project I get the following error message.
Image of the Error Message:
I already tried everything from re-installing IntelliJ to re-importing the project or redownloading the dependencies. I simply dont know why IntelliJ doesn´t find the dependencies.
My pom.xml looks as following
Image of my pom.xml:
The first time I tried to edit the pom.xml
it said to me "this file does not belong to the project". Maybe this might be one reason.
Running the whole thing with 'mvn install' or 'mvn clean verify' works.
Upvotes: 12
Views: 60129
Reputation: 1
I also had the same issue. Just check:
Then in settings-> build, execution, deployment->build tools-> maven -> select the maven home path to bundled maven 3
.
Then reload all from disk or press Ctrl+Alt+y. My issue was resolved by the reloading.
Upvotes: 0
Reputation: 11
For me this method worked, seems dependencies are not downloaded due to wrong Maven home path.
settings >> Build, Execution, Deployment >> Build Tools >> Maven >> change maven home path from "use maven wrapper" to Bundled(Maven 3)
Upvotes: 1
Reputation: 11
I had same issue. I was using IntelliJ IDEA. In my case I deleted .idea folder and re-build the project then it worked well.
Upvotes: 1
Reputation: 111
I have the same error. I removed all folder and file in this path below:
C:\Users\Lenovo.m2\repository
I opend the intelij IDE and opened the maven:
View -> Tool Windows ->Maven
and clicked on the "Reload All Maven Project". it downloaded the dependencies and run the project again. check before the path below:
C:\Users\Lenovo.m2\repository
it should download all the dependencies.
I hope it is helpfull.
Upvotes: 0
Reputation: 1
I had the same issue , only to find out I made a very careless mistake of having 2 versions of IntelliJ.
I uninstalled all of them and did a new installation, now everything works.
Upvotes: 0
Reputation: 1
For my case, had to change the maven importing settings from the JRE path to the JDK path on my local machine
Upvotes: 0
Reputation: 11
Follow these steps, your problem should be solved. You just need to add Spring-framework-starter-web
and Spring-framework-starter-tester
from your pom.xml
file.
Upvotes: 1
Reputation: 331
You need to change Maven's JDK for importing
option from Project JDK to the Path variable for Java on your machine.
You can get to this by going to Settings
-> Build, Execution, Deployment
-> Build Tools
-> Maven
-> Importing
. Scroll down to the bottom and look for JDK for importing:
. Select from the list the path variable for JAVA.
For Windows users, JAVA_HOME
should be an option in the drop-down list.
Upvotes: 0
Reputation: 51
I just had the same issue. My solution was to remove all dependencies from the pom, reload via maven -> Reload All Maven Projects. Run mvn compile. Add dependencies back to the pom, maven -> Reload All Maven Projects. Run mvn compile. Now the Intellij build works.
Upvotes: 1
Reputation: 1288
Sometimes your workspace could get corrupted. In my case, I tried to Reload the project and it worked
Upvotes: 6
Reputation: 1546
Had the same problem. I have tried everything: invalidating cache, deleting the whole .m2 folder, changing settings, reloding the project, nothing helped.
The solution for me was to delete the .iml files which are IntelliJ module files used for keeping module configuration. After reopening the project it worked.
The idea was not mine, I found the hint here: https://intellij-support.jetbrains.com/hc/en-us/community/posts/203365204--package-does-not-exist-error-despite-autocomplete-being-aware-of-them
Upvotes: 18
Reputation: 1503
in my case changed JDK version in Maven importer from JDK 11 to my local JDK version 1.8
Upvotes: 2
Reputation: 5513
Here is how my IntelliJ settings for spring boot application looks like
Click open -> browse your workspace -> and select POM.xml file
Check this in your intelliJ settings
Do this too [Settings --> Maven --> Importing
]
Upvotes: 1