C:\Users\firstJavaProject>gradle build
FAILURE: Build failed with an exception.
* Where:
Settings file 'C:\Users\firstJavaProject\settings.gradle' line: 20
* What went wrong:
Plugin [id: 'org.gradle.toolchains.foojay-resolver-convention', version: '0.4.0'] was not found in any of the following sources:
- Gradle Core Plugins (plugin is not in 'org.gradle' namespace)
- Plugin Repositories (could not resolve plugin artifact 'org.gradle.toolchains.foojay-resolver-convention:org.gradle.toolchains.foojay-resolver-convention.gradle.plugin:0.4.0')
Searched in the following repositories:
Gradle Central Plugin Repository
Google
MavenRepo
* 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 get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 813ms
I have tried using plugin management
Seems it doesn't work in my case, here are my configurations:
settings.gradle file:
plugins {
// Apply the foojay-resolver plugin to allow automatic download of JDKs
id 'org.gradle.toolchains.foojay-resolver-convention' version '0.4.0'
}
One can't just add random plugins without also adding the source repository:
https://plugins.gradle.org/plugin/org.gradle.toolchains.foojay-resolver-convention
...which in this case is gradlePluginPortal()
:
pluginManagement {
repositories {
gradlePluginPortal() // this one is missing.
mavenCentral()
google()
}
}
As one can see, you're also using a quite outdated, if not obsolete, version.
And adding plugins in settings.gradle
is also a questionable approach ...