如何使Intellij IDEA使用并行和gradle构建缓存进行构建



什么控制Intellij IDEA IDE构建/重建如何使用gradle构建缓存和并行选项?

我有 gradle 构建缓存设置,如果我通过 IDEA 运行配置运行 gradle,我会看到以下内容:

45s clean build --parallel -x test
34s build --parallel -x test

如果我点击锤子来建造或选择建造:重建,我看到 2m10s 及以上的时间。

如何启用缓存

在命令行上并通过 runConfiguration,速度提升非常出色。 当通过Intellij的锤子构建时,事情要慢得多

gradle.properties

# Enable gradle build cache
org.gradle.caching=true
gradle.cache.push=false

settings.gradle

ext.inJenkins = System.getenv().containsKey("BUILD_NUMBER")
buildCache {
local {
enabled = !inJenkins
}
remote(HttpBuildCache) {
enabled = true
url = "${artifactory_url}/gradlecache-generic-development-local/"
...
push = inJenkins
}
}

您可能没有在 gradle 属性中启用并行性。

添加到 gradle.properties

org.gradle.parallel=true

祝你今天开心

最新更新