I have a project that can be compiled by Gradle 2 from the command prompt. But it cannot be compiled by Gradle 3.
In Eclipse I am trying to apply Configure/Add Gradle Nature. Then I am getting an error: “org.gradle.tooling.BuildException: Could not run build action using Gradle distribution ' https://services.gradle.org/distributions/gradle-3.5-bin.zip '.”
Is there any way to configure the project for Gradle 2?
Actually this BuildException is thrown when a Gradle build fails or when a model cannot be built.
You can refresh dependencies in your cache with the command line option --refresh-dependencies
.
You can also delete the cached files under ~/.gradle/caches
. With the next build Gradle attempts to download the dependencies again.
If your project is previously built and deployed using specific version, then you don't need to make headache to use another version. You can easily do it by adding wrapper in build.gradle file.
// Running 'gradle wrapper' will generate gradlew - Getting gradle wrapper working and using it will save you a lot of pain.
task wrapper(type: Wrapper) {
gradleVersion = '2.2'
}
For more, you can go through this tutorial: The Gradle Wrapper
What the Gradle Wrapper does?
When you run the Gradle Wrapper it performs the following actions:
The wrapper is effectively completely decoupled from Gradle itself.
One of the files the wrapper puts in your project is a configuration file at gradle/wrapper/gradle-wrapper.properties
.
This file typically looks something like this:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.0-all.zip
distributionBase + distributionPath --> specify the path at which the wrapper will store Gradle distributions. By default GRADLE_USER_HOME is ~/.gradle
, so the wrapper will store Gradle distributions at ~/.gradle/wrapper/dists
.
zipStoreBase and zipStorePath are very similar. These specify where the wrapper will store the zipped distributions it downloads.
distributionUrl --> It specifies what version of Gradle you want to use for your builds and where to download it from.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.