Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I force update all the snapshot Gradle dependencies in intellij

I have a project with SNAPSHOT dependencies using gradle as its build tool in intellij.

The problem is that intellij is using SNAPSHOTS that are now outdated. enter image description here

When I build the project on the command line

gradle build or  gradle clean build --refresh-dependencies 

On command line the latest dependencies are fetched. I also setup my grade file to always download snapshot dependencies according to this answer.

How can I force intellij to download all dependencies?

like image 276
Vad1mo Avatar asked Sep 18 '15 13:09

Vad1mo


People also ask

How do I refresh Gradle dependencies?

Simply open the gradle tab (can be located on the right) and right-click on the parent in the list (should be called "Android"), then select "Refresh dependencies". This should resolve your issue.


2 Answers

In IntelliJ 2017.2 you can right-click on the project name in the Gradle Tool Window and select Refresh dependencies from the context menu.

Refresh Gradle dependencies in IntelliJ 2017.2

This will refresh all your dependencies, not only the SNAPSHOTS, so it might take a while. I don't know if other versions of IntelliJ also have this feature.

like image 146
Elliot Vargas Avatar answered Oct 18 '22 12:10

Elliot Vargas


I have run into some very sticky snapshots. There are a few options you can try:

  • On the Gradle tab (right side of UI), click the blue circling arrows icon, which should refresh the dependencies (works in most cases)
  • If that does not work, try running the gradle command in IntelliJ using the Green "run Gradle command" icon - this runs the command in IntelliJs environment not that of your local machine.
  • If both of those fail, you can modify your Gradle resolutionStrategy settings to something like: configurations.all { resolutionStrategy.cacheDynamicVersionsFor 4, 'hours' resolutionStrategy.cacheChangingModulesFor 4, 'hours' } This config change is a last-ditch option and should be used sparingly. It basically tells Gradle to refresh the local cache more often. You should click the IntelliJ Gradle refresh button after making these changes.
like image 35
cjstehno Avatar answered Oct 18 '22 13:10

cjstehno