I have a problem with Gradle in vscode, when trying to build a project, it throws an exception: “org.gradle.api.plugins.internal.DefaultDecoratedConvention”. At the same time, the manually installed Gradle 9.0.0 builds the project without problems.
Project root:
| gradle
| \ wrapper
| \ gradle-wrapper.jar
| \ gradle-wrapper.properties
| \ libs.versions.toml
| src
| \ main
| \ java
| \ project
| \ Library.java
| \ resources
| build.gradle.kts
| gradle.properties
| gradlew
| gradlew.bat
gradle-wrapper.properties:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-9.0.0-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
libs.versions.toml:
# This file was generated by the Gradle 'init' task.
# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format
Library.java:
package project;
public class Library {}
build.gradle.kts:
plugins {
id("java")
id("java-library")
}
repositories {
mavenCentral()
}
dependencies {}
java {
withSourcesJar()
toolchain {
languageVersion = JavaLanguageVersion.of(21)
}
}
sourceSets {
main {
java {
srcDir("src/main/java")
}
}
}
tasks.jar {
manifest {
attributes(mapOf("Implementation-Title" to project.name,
"Implementation-Version" to project.version))
}
}
gradle.properties:
name = project
version = 0.1.0
vscode output:
[info] Java Home: E:\Program Files\Java\jdk-21
[info] JVM Args: -XX:MaxMetaspaceSize=384m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=UTF-8,-Duser.country=RU,-Duser.language=ru,-Duser.variant
[info] Gradle User Home: C:\Users\Micro\.gradle
[info] Gradle Version: 9.0.0
[error] FAILURE: Build failed with an exception.
* What went wrong:
org.gradle.api.plugins.internal.DefaultDecoratedConvention
> org.gradle.api.plugins.internal.DefaultDecoratedConvention
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to generate a Build Scan (Powered by Develocity).
> Get more help at https://help.gradle.org.
CONFIGURE FAILED in 176ms
[error] Error getting build for d:\project: The supplied build action failed with an exception.
[info] Found 0 tasks
[error] [gradle-server] The supplied build action failed with an exception.
vscode expansion:
I was trying to go through the configurations of the vscode extensions responsible for gradle java:
- Reset the configuration.
- I’m being asked to install Gradle and Java manually.
- Changed the location of Gradle and Java via GRADLE_HOME and JAVA_HOME.
But no matter how hard I try, this error still appears, apparently the problem is in vscode, since errors do not occur when using Gradle installed manually.