rohit kesarvani
rohit kesarvani

Reputation: 433

Plugin [id: 'org.springframework.boot', version: '2.2.4.RELEASE'] was not found in any of the following sources:

I have just downloaded the springboot project from http://start.spring.io/. After running it I got this error.

* What went wrong:
Plugin [id: 'org.springframework.boot', version: '2.2.4.RELEASE'] 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.springframework.boot:org.springframework.boot.gradle.plugin:2.2.4.RELEASE')
  Searched in the following repositories:
    Gradle Central Plugin Repository

* 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.

Can any one please suggest what is root cause.

Upvotes: 33

Views: 137769

Answers (17)

兰草酱
兰草酱

Reputation: 1

It is possible that the gradle agent is misconfigured.

If you have previously modified the proxy for this file, it may prevent gradle from downloading the plugin directly from the source.

  1. Checking [user]/.gradle/gradle.properties file.

  2. Delete the proxy address at the bottom of the file or change it to the one in use.

gradle.properties image

Upvotes: 0

Diego Virgüez
Diego Virgüez

Reputation: 164

Check you java configuration of the project and the java configuration of gradle. Should be the same and works for me.

Upvotes: 0

Hari Krishna
Hari Krishna

Reputation: 11

Unfortunately, gradle doesn't log the actual issue. Instead it always wrapped with exception,

org.gradle.api.plugins.UnknownPluginException: Plugin [id: 'org.springframework.boot', version: '2.7.14'] was not found in any of the following sources:

If its working with local repository or any other old repository, then issue might be related to certs.

In my case, i have provided the below configurations in gradle.properties on macOS

systemProp.javax.net.ssl.trustStore=/dev/null
systemProp.javax.net.ssl.trustStoreType=KeychainStore

Upvotes: 1

Luiggi33
Luiggi33

Reputation: 63

I had the Gradle offline mode enabled in IntelliJ. After I turned that off in the Gradle Window, I was able to build using Gradle.

Upvotes: 1

wakedeer
wakedeer

Reputation: 642

You are using incompatable gradle versions!!!

Check your gradle version:
your gradle version: gradle --version
project version: gradle/wrapper/gradle-wrapper.properties has property distributionUrl where you can find project version

If there is difference between your gradle version and project gradle version just download and use project gradle version https://gradle.org/releases/

Upvotes: 3

Shabar
Shabar

Reputation: 2823

I had the same error. The reason was in my Windows machine path to the java certs in gradle.properties file having in correct format (i.e / instead of \ ) systemProp.javax.net.ssl.trustStore=<JAVA_HOME>\\lib\\security\\cacerts

Upvotes: 0

GTkds007
GTkds007

Reputation: 53

I had this problem, too. I used the OpenJDK 1.8 in my Spring Boot Project which for whatever reason created these complications, so I changed it to Amazon Corretto JDK 11 and the sync and build ran without errors.

If you use IntelliJ I would recommend you to change your SDK in the Project Structure/Project, Project Structure/Modules and Project Structure/SDKs and finally change the Gradle JVM to the new JDK version in Settings/Build, Execution, Deployment/Build Tools/Gradle/GradleJVM.

Upvotes: 2

Rajeev Barnwal
Rajeev Barnwal

Reputation: 1347

Team adding below in build.gradle will help solve the issue:

allprojects  {
    apply plugin: 'maven'
    apply plugin: "io.spring.dependency-management"

    group = 'com.wnp'
    version = '6.5.0-SNAPSHOT'
}

Upvotes: 0

gizmo
gizmo

Reputation: 111

None of the answers above worked for me, what fixed it was removing '.RELEASE' from the version (see here)

id("org.springframework.boot") version "2.5.4.RELEASE"

to

id("org.springframework.boot") version "2.5.4"

Upvotes: 3

Luiz Rossi
Luiz Rossi

Reputation: 892

Guys for me was just old Gradle version, I updated following this link https://gradle.org/install/. For Ubuntu:

$ mkdir /opt/gradle
$ unzip -d /opt/gradle gradle-7.0.2-bin.zip
$ ls /opt/gradle/gradle-7.0.2
LICENSE  NOTICE  bin  getting-started.html  init.d  lib  media

Upvotes: 0

Vasanth Subramanian
Vasanth Subramanian

Reputation: 1341

Accepted answer didn't work for me. I am able to resolve this after adding settings.gradle file in project root with,

settings.gradle:

pluginManagement {
    repositories {
        maven { url "<Repo_URL>" }
    }
}

Upvotes: 27

wn32v1.0
wn32v1.0

Reputation: 31

I could solve it as follows:
In the build.gradle file add the following lines:

Add these lines to build.gradle

Then you must open a command window and enter the folder where you have the project and execute the following order:
gradle build

That's it, with this your error must be solved ... Greetings !!!

Upvotes: 2

akarahman
akarahman

Reputation: 368

I had this issue too, after trying out all the above it wasn't resolved. Then by trying gradle with other versions and other version of JDK, then I figured out that it was due to SSL authentication issue. In my case I have to add the security certificates from my local nexus repository to the JDK used by Gradle and the problem was resolved.

You can download the SSL certificates by browsing to the nexus repository manager and downloading it from the browser.

Upvotes: 0

Tushar Jajodia
Tushar Jajodia

Reputation: 451

First of all you need to understand the problem. Why did this error occur ? The lines in build.gradle file

plugins {
       id 'org.springframework.boot' version '2.2.4.RELEASE'
       id 'io.spring.dependency-management' version '1.0.9.RELEASE'
       id 'java'
}

tells gradle that "spring" and "java" are required for you project to build. Plugins are task in gradle.

Now for compiling the project the gradle has to bring these plugins specified. for that it will look in the repositories that you have specified. in

repositories {
            mavenCentral()
}

So There must not be any problem with the Code. Refreshing must solve

Upvotes: -2

Alejandro
Alejandro

Reputation: 99

In my case I had configured a proxy from my job in the gradle.properties file, but I wasn't through their VPN.

If this is also your case, you can just comment the lines in that file, or just connect to the VPN if it is possible.

Upvotes: 10

Gro
Gro

Reputation: 1683

The default build.gradle file generated by spring.io only includes mavenCentral in repositories. Not sure why, but once in a while, this error shows up. Add jcenter as well in there, it should work. To be more clear repositories could look like following after change

repositories {
    jcenter()
    mavenCentral()
} 

Upvotes: -1

Harshith Patte
Harshith Patte

Reputation: 382

I would recommend you to run gradle build command in your terminal. After this, do a gradle sync.

Must be some problem with your IDE.

Hope this solves your issue.

Upvotes: 29

Related Questions