Maven Dependencies Red underlines

已回答

I have a Maven project (obviously).  Several of the dependencies, but not nearly all, have red underscores in the Maven Projects window.  If I do a Build/Rebuild Project everything builds fine.  From the Maven Projects window if I execute a compile goal it works without error.  If I do an external mvn compile it works great  If I look in my local maven repository all the files are right where they belong. In short everything except these underscores is perfect.

This is a mature production project, and on other team member's PCs, as well as my old one, it doesn't have this problem.  I've read that Intellij will also use the underscore to denote a conflict as well as missing dependency.  But conflict doesn't make any more sense than missing.

What steps can I take to further diagnosis this problem, or better yet just fix it?

10

Similar issue was resolved recently, make sure you run 2019.2.2 release or later.

0
Avatar
Permanently deleted user

Is there a link or a pointer to the issue that was recently resolved in 2019.2.2?

I am also having this, or a similar issue and running 2019.2.2 on macOS 10.14.6.  New library added to a mature Grails project and all of the code using the new library shows red underlines on my machine (but not others), even though the project runs and works fine.  All usages of classes from the new library show "Cannot resolve symbol 'foo'".

I have tried invalidating the caches and restarting many times, deleting the jar from the Maven repo and letting it re-download, refreshing Grails dependencies.  Nothing seems to fix the red.  I have been combing through YouTrack to find other similar issues and hoping a magic fix is in the comments of one those.

1

That issue was Maven specific, not Gradle.

Please report a new issue at https://youtrack.jetbrains.com/issues/IDEA and provide the steps to reproduce it.

See if removing .idea directory and reimporting from build.gradle helps.

0
Avatar
Permanently deleted user

We are using Maven, not Gradle.  It is still a 2.5.6 Grails project.

0

I see, then try reimporting from pom.xml after deleting .idea directory.

If it doesn't help, report a bug with the logs attached: Help | Compress Logs and Show in ...

0
Avatar
Permanently deleted user

Thank you for the suggestions... I have already tried reimporting multiple times, though.  I'll keep looking on YouTrack.

0

There are some known issues with Maven 3.6.2 in the current version, check that you are importing with 3.6.1.

0
Avatar
Permanently deleted user

as prickett said, deleting the .idea directory and reimporting the project also worked for me. 

0
Avatar
Permanently deleted user

Restarting fixed it for me. Same issue - underlines in deps, but everything fine. No tool top to explain. Is there a log somewhere you can see these messages perhaps?

0

I have the same problem, I tried all suggestions from this topic but they don't work, including run maven 3.6.1 and 3.6.1, the new project from cmd and InteliJ ... Right now I have to mark pom as plain. But what is interesting whole project runs with all maven dependencies with no problems.

0

Please report at https://youtrack.jetbrains.com/newIssue?project=IDEA and attach the logs: Help | Compress Logs and Show in ...

0

I did this to get it to work.

 

Delete the file(s) that have the red underlines.

Build the module -> This obviously has more errors now

Revert the deletion using Git commands

Rebuild the model !!

 

All good now!

0

After scratching my head for sometime, Following are the steps which worked for me:

1. Delete .idea folder (rm -rf .idea) - make sure to take backup, if needed

2. Re-import the project in IntelliJ

3. Optionally, it will ask you to Setup SDK (so, just click a button)

And you are good to go!!!

0

请先登录再写评论。