Refreshing Gradle dependencies doesn't work sometimes

Answered

I have a Gradle module which is part of a project. Sometimes when I update the version of a dependency in the build.gradle file and after that refresh Gradle dependencies of that module in the Gradle pane, it doesn't work which I confirm by holding the command key (mac user) and hover over a java import to see which dependency it comes from. When I check the library tab in the project structure window, I see both old and new version of that dependency. After deleting the old version from there and redo refresh Gradle dependencies, it still doesn't work. Even after quitting and starting the Intellij app it still doesn't work. Is there a step I missed?

3 comments
Comment actions Permalink

What IDE version do you use? Does it happen in 2020.2 release? Any exceptions in the logs? https://intellij-support.jetbrains.com/hc/articles/207241085.

Refreshing the dependencies should remove the old one and add the new one unless you have some component that depends on the old version so that 2 different dependency versions are added at the same time to the classpath and whichever comes first is used.

0
Comment actions Permalink

I just upgraded Intellij to 2020.2 so I don't know on which version I saw the issue but as far as I can recall it's the 2019.02 version. As the dependency version that comes first is used, how do I adjust the order?

0
Comment actions Permalink

Could you please attach screenshot of the Dependencies tab for this module (File | Project Structure | Modules | <module name> | Dependencies) where all dependencies including mentioned would be visible? Please also attach idea.log (Help | Show Log in ... action) file after IDE restart and reproducing issue with Gradle refresh. For uploading you can use https://uploads.services.jetbrains.com or any file sharing service.

>Sometimes when I update the version of a dependency in the build.gradle file

Please also clarify - where does this dependency come from - your local repository, from global Maven central repository or else? Does it happen with any dependency in project?

Thank you.

0

Please sign in to leave a comment.