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
58 comments

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

Can you resolve the dependencies using maven from the command line?

If you are behind a proxy or go via a corporate maven repo you will have to edit your maven settings file (~/.m2/settings.xml)

-1

i did all that but still is not resolved

1

that's how my maven settings looks like

3

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

 

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

0

it's highlighting my class with a red lines

0

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

7

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

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

@Andrey Dernov i have shared my IDE log

0

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

ok let me try that

0

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

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

0
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>

And I specify it on the pom
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

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

.iml files store the module roots and dependencies information. They are generated automatically when the project is imported from Maven.

There is an option to store these files externally, if it's enabled, the module info will be saved under IDE system directory, not in the project directory.

0

I have a similar issue with Spring annotation, after deleted the cache folder in my user home `/Library/Caches/IntelliJIdea2019.3/` was solved. 

0

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

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

 

4

Same problem, just updated a dependency to pick a new function and mvn build works great, and intellij still pointing to the old version. I confirmed both versions exist on my desk after mvn install, so deleted the old version and it's just decided to complain the whole package does not exist. I did everything recommended above, and intellij still looking for the old deleted version. 

0

Does it help if you delete .idea directory and reimport the project from pom.xml?

(make sure to create a backup of this directory and then copy back the code styles, run configurations and other configuration files that are not related to the module and project structure, don't copy modules.xml back).

0

I do not want to do this. I got a lot of setup for this project that I do not want to re-do. tbh, I am new to intellij because eclipse is getting to be very slow, but if I have to setup this project, I will have to do it in eclipse. Because I can not set it up everytime there is a lib change, which is very common. 

0

Normally all the changes to the dependencies should be picked up automatically just after the refresh of the project. If it doesn't work for you, please submit a ticket to support ( https://intellij-support.jetbrains.com/hc/requests/new ), attach the logs (Help | Compress Logs and Show in ...) and a small sample project to reproduce the issue.

0

Please sign in to leave a comment.