Beginner here.
I get this build error when trying to build a project in visual studio code:
Executing Gradle tasks as part of a build without a settings file is not supported. Make sure you are executing Gradle from a directory within your Gradle project. Your project should have a 'settings.gradle(.kts) file in the root directory.
The thing is, is that there is already one there.
I believe it is because it is VSCode is using Gradle 7.x.x when I should be using 6.5.0.
Does anyone know how to change gradle version on visual studio code?
CodePudding user response:
If you're using the Gradle for Java extension in VSCode and you have the Gradle wrapper in your project, the extension should use the version the wrapper is using by default, so specify the correct version there.
You can do that by manually updating the distributionUrl
property in <your-project>/gradle/wrapper/gradle-wrapper.properties
or by running the below command:
./gradlew wrapper --gradle-version <your-desired-version>
If you don't yet have a Gradle wrapper in your project, I would suggest you add it as it is the recommended way to execute Gradle builds. You can add it to your project with the following command
gradle wrapper --gradle-version <your-desired-version>
All listed commands are meant to be executed in the root folder of your project.
Documentation on the wrapper: https://docs.gradle.org/current/userguide/gradle_wrapper.html