45

I created a Spring MVC project ion Intellij IDEA. When I build my project, following message is displayed, how can I resolve it?

Plugin [id: 'org.springframework.boot', version: '2.1.7.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.1.7.RELEASE')
  Searched in the following repositories:
    Gradle Central Plugin Repository
Rostislav Matl
  • 4,294
  • 4
  • 29
  • 53
steven nguyen
  • 571
  • 1
  • 4
  • 7
  • The Gradle central plugin repository definitely has that plugin ([here](https://plugins.gradle.org/plugin/org.springframework.boot)). Are you sure you had a working internet connection when you tried to run? – user31601 Aug 28 '19 at 09:01
  • Thank your answer, my computer is still connected to the internet while building the project, but the result is the same. – steven nguyen Aug 28 '19 at 09:13
  • Check if you need a proxy to access the internet. Otherwise do you have a settings.xml properly configured in your local .m2 config. You maybe need a definition to maven central repo.... – vikingsteve Aug 28 '19 at 09:22
  • Yes, my proxy has been blocked, my IT has opened the proxy for me.Thank you – steven nguyen Aug 28 '19 at 09:48

11 Answers11

32

I saw the problem even on command line and it helped when I added plugin management to the start of setting.gradle file:

pluginManagement {
    repositories {
        maven { url "https://plugins.gradle.org/m2/" }
        gradlePluginPortal()
    }
}
Rostislav Matl
  • 4,294
  • 4
  • 29
  • 53
21

In my case, the issue was incorrect Gradle JVM version had to be changed in the gradle settings.

On changing the gradle JVM version to the Project's JVM version, this error got resolved.

enter image description here

17

add this at the beginning of settings.gradle file

pluginManagement {
    repositories {
        gradlePluginPortal()
        google()
        mavenCentral()
    }
}
RicHincapie
  • 3,275
  • 1
  • 18
  • 30
Ebuka Udeani
  • 171
  • 1
  • 5
2

I checked my proxy, it only access to a number of pages so the situation is on, after contacting technical staff, it worked.

steven nguyen
  • 571
  • 1
  • 4
  • 7
  • I'm having the same problem. What URL did you tell your proxy team you were trying to reach? I'll need to do the same. – Jonathan M Dec 04 '19 at 16:47
  • Thanks for the tip with the proxy. In my organization we use cntlm which is coupeled to my Windows password. Today I've changed it and updated my .ini file accordingly, however I always forget to update my proxy password in IntelliJ also. Now everything works. – Younes El Ouarti Jan 06 '20 at 17:11
1

You can be missing a plugin repository as mentioned by other people. In a corporate environment if custom plugins can be presented in build files then a plugin repository URL, user & pass need to be set somehow. The easiest way to do that is through a file ~/.gradle/gradle.properties and a snippet adding that custom repo in projects's settings.gradle.

MaxNevermind
  • 2,784
  • 2
  • 25
  • 31
  • I found the easiest way to circumvent is set gradle user name to current working directory like `export GRADLE_USER_HOME=$PWD` to avoid global gradle options, given one know what they are doing – lcs Mar 18 '22 at 18:36
0

In my case, gradle couldn't see my keystore. If you are using Windows Subsystem for Linux, gradle seems to be able to see keystores in the Windows filesystem (/mnt). Also, gradle seems to not be able to resolve home folder paths defined with the tilde:

  • This does not work: ~/cacerts
  • This does work: /home/me/cacerts
Greg
  • 2,476
  • 4
  • 22
  • 28
0
  • In my case it was the incorrect jvm with gradle and the project in itself, it will not find the correct plugins if its on the wrong version of Java etc.
  • Solution: CMD + , then check the jvm version
  • Perhaps putting the path to the jdk as an environment variable incase you need to use it again, it will save time.
0

My java environment in wsl was configured to work within my company environment with maven. Gradle needed more access so I needed to discover, acquire, and import external certificates to my cacerts. Unfortunately, gradle was not returning information that clearly pointed out that it was a certificate and access problem. It was saying it had searched a set of repositories and not found the resource. The errors read as if gradle could access the repo, but not find the resource. Not that gradle could not access the repo.

So, I used Chrome to navigate to the various repos in my build.gradle and determined which repos I need to access and started with gradle.org. I exported the cert from the browser then imported it to my cacert with:

sudo keytool -importcert -trustcacerts -cacerts -storepass changeit -file ~/gradle.org.crt -alias gradleplugins

After importing that cert I confirmed that no gradle daemon was running and tried my gradle clean command again. I iterated through each subsequent 'PKIX path building failed:' error I received and exported and imported each cert until success.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Apr 04 '23 at 11:52
  • what is gradle.org.crt? one you downloaded from chrome? Where is your cacert? There is on under jdk's security folder? Are you updating that as well? – atasoyh Apr 13 '23 at 11:11
0

In my case, I deleted .gradle directory and File > Invalidate caches then, problem resolved. I thought gradle plugins, library version were not problem.

YOSEPH NOH
  • 87
  • 4
0

I fixed it by changing the gradle JDK

enter image description here

AzyCrw4282
  • 7,222
  • 5
  • 19
  • 35
Javid Sattar
  • 749
  • 8
  • 14
0

Do gradle build or ./gradlew build before sync to cache all of these dependencies and plugins, some IDEs corrupt at this point