Gradle解析策略cacheDynamicVersionsFor无法正常工作

时间:2019-09-12 06:29:02

标签: java gradle cache-dependency dependency-resolution resolutionstrategy

我想每次推动Gradle重新下载我的SNAPSHOT依赖项。 可以通过--refresh-dependencies进行。
但我想以编程方式以另一种方式做到这一点:

configurations.all {
    resolutionStrategy.cacheDynamicVersionsFor 0, 'seconds'
    resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}

dependencies {
    compile(Libraries.staffdetails_biz) { changing = true }
}

(我知道如果版本为SNAPSHOT,则无需添加changing = true,但以防万一,请添加它)

因此,在那之后,当我运行我的应用程序./gradlew clean bootRun --info时 我看到下一条日志:

Downloading https://artifactory.intra.max-it.com/beauty-mvn/jp/co/max/beauty/staffdetails-biz/1.2.0.0-test-SNAPSHOT/maven-metadata.xml to /private/var/folders/1t/yrqc_w552kl_8d5bknxkmfd07bv2xj/T/gradle_download937200563233010269bin
Downloading https://artifactory.intra.max-it.com/beauty-mvn/jp/co/max/beauty/staffdetails-biz/1.2.0.0-test-SNAPSHOT/staffdetails-biz-1.2.0.0-test-SNAPSHOT.pom to /private/var/folders/1t/yrqc_w552kl_8d5bknxkmfd07bv2xj/T/gradle_download778741251330227118bin

问题是,它下载了pom文件,但没有下载jar。我应该更改自己的构建脚本以使其按预期工作吗?


而且只有当我指定--refresh-dependencies时,它才会下载jar:

Downloading https://artifactory.intra.max-it.com/beauty-mvn/jp/co/max/beauty/staffdetails-biz/1.2.0.0-test-SNAPSHOT/staffdetails-biz-1.2.0.0-test-SNAPSHOT.jar to /private/var/folders/1t/yrqc_w552kl_8d5bknxkmfd07bv2xj/T/gradle_download1419898241363246448bin

0 个答案:

没有答案