Intellij not resolving maven dependencies

Answered

I am using intellij to build my maven project. the project build successfully and run the problem is that intellij is not resolving my dependencies.I tried to restart but the problem is not being resolved. I also tried to clean the logs but no luck. Please assist

12
59 comments

You could try File - Invalidate Caches/Restart although be aware that also removes your local history I think

7

I needed to right-click on pom under project view and "re-import" sorry for the noise.

 

4
Avatar
Permanently deleted user

that's how my maven settings looks like

3

Here is what worked to me >

1- Right Click the project > Maven > Download Sources 

2- Right Click the project > Maven > Reimport 

 

I think #2 is what made it, so probably no need to #1. Anyway, I do not know why I have to reimport the project to make it work. IDE should be smart enough to pickup the new lib once it's updates in the pom.xml

3

Hi guys,

please try mvn -U idea:idea 

It helped me and everything is working fine right now. This command is responsible for downloading project plugins for Intellij. I hope it will help you as well.

3

For me, the problem is different java versions for project and maven importing settings. 

Go to Preferences -> Build, Execution, Deployment -> Maven -> Importing -> JDK for importer (at the bottom) and set to Use Project JDK (in most cases this should be a case)

 

I don't know how this was changed (maybe I downloaded Java 11) but Intellij, please group some Java versions at the same place if possible

3

I faced with the same issue today... again =( Usually I remove .idea and %userdir%/.IntellijIdeaX folder to solve such things, but this time I was too lazy to restore all cfgs and found one more solution:

- go to %projectDir%\.idea folder

- delete compiler.xml file

- check misc.xml file, if <option name=ignoredFiles"> and its <set> somehow contains the module that Idea is unable to resolve - just remove it from there

- re-import maven project

I've wasted so many time for this issue for a lot of times, hope it will help you =)

2
Avatar
Permanently deleted user

i did all that but still is not resolved

1
Avatar
Permanently deleted user

this are all the commands I tried but still no luck

* Configuration (idea.config.path):
~/Library/Preferences/<PRODUCT><VERSION>
* Caches (idea.system.path):
~/Library/Caches/<PRODUCT><VERSION>
* Plugins (idea.plugins.path):
~/Library/Application Support/<PRODUCT><VERSION>
* Logs (idea.log.path):
~/Library/Logs/<PRODUCT><VERSION>

1

I keep running into this issue.

Maven is cool with the pom dependencies but Intellij is not.

mvn can compile and test but intellij won't build the project.

Tonight it won't recognize that: import org.openqa.selenium.remote.DesiredCapabilities;

is legit and in dependency:

<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>3.141.59</version>
</dependency>
1

Mihailo Stupar Please see if the workaround from https://youtrack.jetbrains.com/issue/IDEA-239150#focus=streamItem-27-4117814.0-0 helps. If the issue remains try to do:

  • File \ Invalidate caches and restart...

  • Close your project window (and IntelliJ) and remove all *.iml files and the .idea folder.

  • Delete/Rename .m2 maven folder.

  • Run mvn clean install from the command line.

  • Re-import the project into IntelliJ from Existing sources.

 

1
Avatar
Permanently deleted user

IntelliJ IDEA 2019.1 (Ultimate Edition)
Build #IU-191.6183.87, built on March 27, 2019
************************
JRE: 1.8.0_202-release-1483-b39 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.14.4

 

that is the version of my intelliJ

0

Hold on, how is your project building successfully and running if the dependencies aren't resolved?

If your dependencies weren't resolved you wouldn't be able to compile.

What do you actually mean by "intellij is not resolving my dependencies"?

0
Avatar
Permanently deleted user

 

intelliJ is not picking up those methods and it looks like they dnt exist but they do exists

0
Avatar
Permanently deleted user

it's highlighting my class with a red lines

0

Please share IDE log folder zipped and if possible a sample project.

For uploading you can use ftp://ftp.intellij.net/.uploads / https://uploads.services.jetbrains.com or any file sharing service.

Try with all custom plugins disabled and re-create project configuration by re-importing the project completely from Maven pom.xml file via File | New | Project from Existing Sources and selecting main parent pom.xml file to import from.

0
Avatar
Permanently deleted user

@Andrey Dernov i have shared my IDE log

0
Avatar
Permanently deleted user

IntelliJIdea2019.1.zip is the name of my IDE log

 

0

No obvious cause seen in logs. There are however errors related corrupted caches or IDE configuration.

Try close the IDE, delete the /Users/abrmagp/Library/Caches/IntelliJIdea2019.1/ directory, start IDE and re-import project from scratch as Maven project as advised. Make sure the import process competed successfully and that you can build the project by IDE (Build | Rebuild Project action).

0
Avatar
Permanently deleted user

ok let me try that

0
Avatar
Permanently deleted user

still the same issue

0

For which symbols do you get "red highlighting" problem? From the attached screenshot it does not look to unresolved Maven dependencies but to unresolved local variables (it does not look related to Maven). Can you share a project to check?

0
Avatar
Permanently deleted user

the think the problem is that is failing to pull Lombok dependency

0
Avatar
Permanently deleted user
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>

And I specify it on the pom
0
Avatar
Permanently deleted user

0

>the think the problem is that is failing to pull Lombok dependency

What makes you think that? Do you see this dependency in Dependencies tab for the module? Can you build project via Build | Rebuild Project action?

Do you use Lombok-generated code? Have you tried lombok plugin?

0
Avatar
Permanently deleted user

For some reason i cannot explain, I was missing the .iml file. In another similar project of my creation from a maven archetype, the iml file was present and the commons-math library of apache for "pointable" using import command. In another project without the iml file (i don't know who when and why this file is created), the library was imported by maven but not "pointable" by import. I just created the .iml file (file name is same of project name), i copied the content from the other project (just a few lines) and now the library was available for use...

If somebody is willing to explain what .iml is used for, i'll appreciate. 

 

Paolo

0

Please sign in to leave a comment.