I'm new to Intellij Idea, i just import a project with pom.xml
, but the ide didn't resolve anything in maven dependencies.
Anything defined in pom.xml
dependencies when import in code raise an error cannot resolve symbol xxxxx
But mvn install
will work, i try import the dependencies in Project Settings/Libraries
in .jar
files, then it works, but could the ide resolve libraries defined in pom.xml
? i don't want to do that everytime.
Additionnal info:
IDEA version: 12.0.3, OS : windows 7, reimport does not work, maven version : 3.0.4, maven dependencies does not exists under Exernal Libraries.
there is no exceptions in idea.log...
In Settings -> Maven -> Repositories only some repositories configured in my settings displayed.
Workaround
It is probably a bug (Idea 13.1.5 Ultimate). It helped me to switch the mirrors. The one that was not showing up to the top.
Keep in mind that IntelliJ adds your local Maven installation's classes to its own classpath, so keep it up to date.
In my case IntelliJ tried to call method
org.eclipse.aether.util.ConfigUtils.getFloat()
. This caused ajava.lang.NoSuchMethodError
, because my years old Maven version didn't contain this method yet. Due to the exception IntelliJ stopped resolving dependencies.After updating Maven, you have to change the "Maven home directory" setting in "Build, Execution, Deployment" -> "Maven". After that you must restart IntelliJ, because the classpath of IntelliJ's JVM won't change while running.
It took me some time to solve this problem, as I didn't expect IntelliJ to use the classes of my local Maven installation. I thought it uses it's own bundled JARs. So hopefully this information is helpful for others.
I have tried several options, but this one finally solved my problem. I re-imported the project by following these steps in IntelliJ:
Choose your project from 'Select File or Directory to Import'
In the next screen choose 'Import Project From external model', and choose 'Maven.
For me re-importing maven projects did not solve the issue for an existing projects.
3 Simple Steps: IntelliJ 14:
File>settings>Build,execution,deployment>Build tools
Select Maven
Maven home directory: C:/Program Files/apache-maven-3.3.3 (your equivalent location)
It seems to me that solutions to this problem is plenty and all look a bit like magic. For me, invalidation of caches, re-importing or anything else already mentioned was not working. The only thing that helped was (without re-import) go to Maven settings, uncheck automatic importing and re-check it back.
I had the very same problem as author!
To solve my issue I had to add Maven Integration Plugin: File | Settings | Plugins
Like this:
After that Intellij downloaded all the dependencies from pom.xml file.
Now if I want to create a project based on maven model, I just choose Open on the first Intellij window and choose the pom.xml file: