我们有一个gradle依赖项,它具有相同的名称,但变化很大,因此我们希望始终重新获得它。依赖关系存储在工件中,其内容为:
entity-configurator-0.6.2-staging-sources.jar 12-Jun-2019 09:33 110.19 KB
entity-configurator-0.6.2-staging.jar 12-Jun-2019 09:33 147.37 KB
entity-configurator-0.6.2-staging.pom 12-Jun-2019 09:33 3.01 KB
我们使用了https://stackoverflow.com/a/14804849此处所述的解决策略。这是build.gradle代码。
configurations.all {
resolutionStrategy {
cacheDynamicVersionsFor 0, "seconds"
cacheChangingModulesFor 0, "seconds"
}
}
...
...
compile ('com.***:entity-configurator:0.6.2-staging') { changing = true }
这将强制gradle始终检查依赖项是否为最新。可能是这样做的,但不正确,就像我运行
时一样./gradlew build --info
输出为
> Task :compileJava
Cached resource https://artifactory.***.net/artifactory/libs-staging-local/com/***/entity-configurator/0.6.2-staging/entity-configurator-0.6.2-staging.pom is up-to-date (lastModified: Wed Jun 12 11:33:33 CEST 2019).
Cached resource https://artifactory.***.net/artifactory/libs-staging-local/com/***/entity-configurator/0.6.2-staging/entity-configurator-0.6.2-staging.jar is up-to-date (lastModified: Wed Jun 12 12:12:36 CEST 2019).
Skipping task ':compileJava' as it is up-to-date.
在这种情况下,依赖关系本身已在工件中进行了更新,但在刷新gradle之后未在我的项目中进行更新。这里的问题是,它们是所需依赖项的两个不同部分(.jar和.pom),并且它们的lastModified时间不同。
Cached resource https://artifactory.***.net/artifactory/libs-staging-local/com/***/0.6.2-staging/entity-configurator-0.6.2-staging.pom is up-to-date (lastModified: Wed Jun 12 11:33:33 CEST 2019).
vs
Cached resource https://artifactory.***.net/artifactory/libs-staging-local/com/***/0.6.2-staging/entity-configurator-0.6.2-staging.jar is up-to-date (lastModified: Wed Jun 12 12:12:36 CEST 2019).
上次修改.jar文件的时间是正确的,pom显然来自先前版本的依赖项。刷新项目后检查.gradle / cache文件夹时,有新的.jar文件,但.pom仍来自以前的版本。有人知道这里的问题是什么以及如何解决?我真的不明白为什么.pom文件没有被更新。