gpt4 book ai didi

gradle - Gradle如何在我的buildscript block 中为SNAPSHOT版本指定cacheResolutionStrategy?

转载 作者:行者123 更新时间:2023-12-04 22:59:23 25 4
gpt4 key购买 nike

我在resolutionStrategy.cacheChangingModulesFor中遇到问题。

我的项目build.gradle看起来与此类似

apply plugin: 'base'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply from: "gradle/mixins/cachestrategy.gradle"
configurations.all {
resolutionStrategy.cacheDynamicVersionsFor 5, 'minutes'
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}

buildscript {
repositories {
maven {
url artifactoryUrl
}
}
dependencies {
classpath (group: 'com.myorg', name: 'aCustomPlugin', version: '1.5.0-SNAPSHOT') {
changing = true
}
}
}

allprojects {
apply plugin: 'base'
apply plugin: 'com.myorg.aCustomPlugin'
}

我的问题是:如何在我的buildscript块中为SNAPSHOT版本指定cacheResolutionStrategy?

最佳答案

在块外指定它是行不通的(因为首先评估了buildscript块,以便构建脚本...),所以尚未评估脚本中定义的缓存策略规则。

解析策略应像这样放置在buildscript块中

buildscript {
repositories {
mavenLocal()
maven {
url artifactoryUrl
}
}
dependencies {
classpath (group: 'com.myorg', name: 'aCustomPlugin', version: '1.5.0-SNAPSHOT') {
changing = true
}
}
configurations.all {
resolutionStrategy.cacheDynamicVersionsFor 5, 'minutes'
resolutionStrategy.cacheChangingModulesFor 0, 'seconds'
}
}

关于gradle - Gradle如何在我的buildscript block 中为SNAPSHOT版本指定cacheResolutionStrategy?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30641661/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com