question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

IntelliJ IDEA 2019.1.3 fails to resolve dependencies

See original GitHub issue

Tldr; “How do I reset ALL plugin state when things go wrong”.

I have been using the bazel plugin for IntelliJ 2019.1.3, bazel 0.25.2, and plugin version v2019.05.13.0.2. Running bazel build //... always works and Sync project with BUILD files always completes successfully. However, IntelliJ sometimes (sometimes but not always) fails to resolve dependencies like so: image

This only happens with dependencies which are being downloaded as jars (not compiled from source) e.g. any maven dependencies. (We are using the rules_jvm_external maven_install rule to download dependencies but this happens with other rules too.)

Although all these dependency jars show up in bazel-REPO_NAME/external/..., they are not appearing in the ‘External Libraries’ explorer area. The .ijwb/.idea/libraries is not being populated with the correct xml entries. Adding libraries manually through the Project Structure dialog (and pointing to the jar used by bazel) works fine and then the dependencies are resolved fine, but the plugin is unable to do this automatically.

This problem can often be fixed by just adding a comma or whitespace to the BUILD file which causes the plugin to retry the dependency resolution. Resetting this whitespace will cause the problem to reappear, seemingly due to some cacheing. I am looking for a way to reliably reset all the state used by the plugin so that it will retry the external libraries resolution without having to add random whitespace or commas to BUILD files. Things tried so far to no avail:

  • File > Invalidate Caches / Restart
  • Reinstalling plugin
  • Bazel -> Sync -> Sync Project
  • Deleting .ijwb and reimporting project

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:4
  • Comments:17 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
occcommented, Jul 14, 2019

I think I’m hitting a similar issue. External dependencies referenced through maven_install didn’t have the right jars in the project.

Looking into Project Settings > Libraries, I noticed that the path to those binaries were incorrect.

Example from my windows machine: commons-lang3-3.9.jar was referencing a path that didn’t exist. [Project Root]\external\maven\v1\https\repo1.maven.org\maven2\org\apache\commons\commons-lang3\3.9\commons-lang3-3.9.jar

I noticed that [Project Root]\external should have been [Project Root]\bazel-[projectname]\external instead.

As a workaround, I created a symlink from [Project Root]\external to [Project Root]\bazel-[projectname]\external and IntelliJ started working properly.

HTH

2reactions
alex-remedios-improbablecommented, Jul 1, 2019

Can we please re-open this issue? We are seeing frequent syncing issues that are only fixed when making trivial edits to BUILD files. It seems the plugin needs to consider the package to be within the working set in order to link dependencies in Intellij.

Read more comments on GitHub >

github_iconTop Results From Across the Web

IntelliJ not resolving Maven dependencies
IntelliJ not resolving Maven dependencies Follow · Reimport the project with Maven · Invalidate the cache and restart IntelliJ · Delete the .idea...
Read more >
Intellij not resolving maven dependencies
Try close the IDE, delete the /Users/abrmagp/Library/Caches/IntelliJIdea2019.1/ directory, start IDE and re-import project from scratch as Maven ...
Read more >
Problems with gradle resolving dependencies
I am evaluating Intellij IDEA 2019.1.3 Ultimate Edition. I am constantly having problems with gradle resolving dependencies, this may be...
Read more >
Maven extension breaks dependency resolution : IDEA-200272
IDEA -217695 Intellij 2019.1.3 not resolving maven dependencies ... Object annotated with * 1 error at com.google.inject.internal.InjectorImpl$2.get(
Read more >
IntelliJ IDEA - Troubleshooting common Maven issues
Maven dependencies imported incorrectly ... If the dependencies weren't imported correctly (IntelliJ IDEA highlights them), try to perform the following actions:.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found