【发布时间】:2019-11-19 18:11:49
【问题描述】:
我有一个项目,其中包含跨多个存储库共享的 3 个通用 jar。我正在使用 Intellij 2019.4。在我的 gradle 构建中,我包含了以下方法:
dependencyManagement {
resolutionStrategy {
// don't cache SNAPSHOT modules; always retrieve them from the maven cache
cacheChangingModulesFor 0, 'seconds'
}
}
这应该告诉 Gradle 不要缓存快照,但我的仍在缓存中。我构建并安装了一个常见的 jar,maven repo 有它,但 Gradle 缓存仍然有一个 24 小时前的 jar。我应该使用其他方法吗?我希望 Gradle 始终使用 .m2 存储库中的内容。
【问题讨论】:
-
你确定过时的 jars 确实在构建中使用吗?我不认为 Gradle 在从本地存储库中获取工件时使用构建缓存。见docs.gradle.org/current/userguide/…
-
是的,我确定。我对更新的 jar 所做的更改没有得到反映。当我导航到源代码时,它会将我带到 Gradle 缓存中的 jar。
-
我有 same problem 并且在我发现之后,看起来 gradle 有某种延迟 ~1-5 分钟,即使您将 resolutionStrategy 设置为 0 秒
标签: gradle build.gradle