如何强制更新intellij中的所有快照Gradle依赖项 [英] How can I force update all the snapshot Gradle dependencies in intellij

查看:655
本文介绍了如何强制更新intellij中的所有快照Gradle依赖项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个具有SNAPSHOT依赖项的项目,使用gradle作为intellij中的构建工具.

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

问题是intellij使用的SNAPSHOTS现在已经过时.

The problem is that intellij is using SNAPSHOTS that are now outdated.

当我在命令行上构建项目时

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.

如何强制intellij下载所有依赖项?

How can I force intellij to download all dependencies?

推荐答案

我遇到了一些非常棘手的快照.您可以尝试以下几种选择:

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

  • 在"Gradle"选项卡(UI右侧)上,单击蓝色圆圈箭头图标,这将刷新依赖关系(在大多数情况下有效)
  • 如果这不起作用,请尝试使用绿色的运行Gradle命令"图标在IntelliJ中运行gradle命令 -这将在IntelliJs环境中而不是本地计算机上运行该命令.
  • 如果这两个都失败,则可以将Gradle resolutionStrategy设置修改为: configurations.all { resolutionStrategy.cacheDynamicVersionsFor 4, 'hours' resolutionStrategy.cacheChangingModulesFor 4, 'hours' } 此配置更改是最后一个选项,应谨慎使用.它基本上告诉Gradle更频繁地刷新本地缓存.进行这些更改后,您应该单击IntelliJ Gradle刷新按钮.
  • 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.

这篇关于如何强制更新intellij中的所有快照Gradle依赖项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆