61

I have a new error in my project that is in the pom.xml file. How can I fix it?

The error below shown in IntelliJ idea:

Plugin 'org.springframework.boot:spring-boot-maven-plugin:' not found  
peterh
  • 11,875
  • 18
  • 85
  • 108
fatemehjafari
  • 629
  • 1
  • 6
  • 7
  • 1
    Please check this similar question : https://stackoverflow.com/questions/30005460/plugin-org-springframework-bootspring-boot-maven-plugin1-3-0-build-snapshot-or –  Aug 18 '20 at 12:11
  • Can you build from command line? Do you have proxies? – Andrey Aug 18 '20 at 13:33

12 Answers12

106

From the Preferences in Intelli J, navigate to "Build, Execution, Deployment > Build Tools > Maven", check the "Use plugin registry", and click "OK".

Then "File > Invalidate Caches / Restart" to reload Intelli J. The error will go away automatically.

TheCodingAnalyst
  • 1,108
  • 1
  • 5
  • 3
  • 19
    In Windows, it is File -> Settings -> Build, Execution, Deployment – Sharm Jun 22 '21 at 16:51
  • 3
    this solution didn't work for me, but it gave me a hint. Finally, I upgraded to version 2.5.5, then the issue was resolved. And then I removed the ver 2.5.5 statement, still worked. Then I realised, actually, you should do something, include but not limit to upgrade version/invalidate & restart/re-install, to force intellij refreshing cache... – karl li Sep 25 '21 at 22:58
  • 3
    If you are someone like me who keep 10 workspaces open at the same time, this will blow away your next 15 minutes for a reasonably size project. Get ready for some patience if you try this! – SanjoS30 Jan 06 '22 at 03:01
  • Awesome, worked for me. I also selected - Clear file system cache and Local History - Ask before downloading new shared indexes Then clicked the "Invalidate and restart" button. – George Smith Mar 12 '22 at 03:08
76

Add following code

    <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <version>${parent.version}</version>
    </plugin>

and then click on the icon as shown in screenshot, to load Maven changes in pom.xml file

enter image description here

Vivek Singh
  • 959
  • 7
  • 10
24

I had the same problem. This summer Intellij suddenly started throwing this error but build went through. I just had to specify version of plugin and it stopped throwing this error.

<plugin>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-maven-plugin</artifactId>
    <version>2.3.4.RELEASE</version>
</plugin>
mixnix
  • 455
  • 3
  • 13
  • How did you find the version information? – Bigeyes Jan 27 '21 at 18:50
  • @Bigeyes Trial and error I guess. I couldn't find information about it on jetbrains forums or stack overflow. – mixnix Jan 28 '21 at 07:17
  • @Bigeyes It is supposed to be the spring boot version used in the file. You can use `${parent.version}` as well, which refers to the same thing. – gsan Jan 27 '22 at 14:10
16

I had the same problem using IntelliJ version 2020.2.4. The solution was to edit the pom.xml file and specify the version of the Spring-Boot Maven plugin, with the following syntax:

    <plugin>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-maven-plugin</artifactId>
        <version>2.4.0</version>
    </plugin>

This Intelli-J release does not recognize the "RELEASE" keyword after the version number, as suggested in the previous answer.

John Good
  • 161
  • 1
  • 2
  • 1
    Please note that this answer only applies to Spring Boot versions 2.4.0+ due to [changes in the versioning scheme](https://spring.io/blog/2020/04/30/updates-to-spring-versions#project-module-version-changes) which dropped the usage of "RELEASE". Versions 2.3.x and below are still published in the form of `x.x.x.RELEASE`. – ParkerM Feb 19 '21 at 21:45
  • 4
    Better would be ${parent.version} – chokdee Apr 04 '21 at 07:44
  • The expression `${parent.version}` is deprecated. Please use `${project.parent.version}` instead. – Jason Law Oct 07 '21 at 03:39
  • This answer plus changing to ${project.parent.version} instead of ${parent.version} worked for me. Thank you @JohnGood – ciara staggs Nov 02 '22 at 21:35
7

What worked for me after long tries is updating the indices of the remote maven repository:

Settings > Build, Execution, Deployment > Build Tools > Maven > Repositories.

Then select the remote repository and then update.

This must work.

ab2311
  • 79
  • 1
  • 1
2

This error comes when you are using a milestone or snapshot release. It will be resolved after adding appropriate pluginRepository elements.

You can read more about it here: https://docs.spring.io/spring-boot/docs/current/maven-plugin/reference/htmlsingle/#getting-started

<pluginRepositories>
    <pluginRepository>
        <id>spring-snapshots</id>
        <url>https://repo.spring.io/snapshot</url>
    </pluginRepository>
    <pluginRepository>
        <id>spring-milestones</id>
        <url>https://repo.spring.io/milestone</url>
    </pluginRepository>
</pluginRepositories>

PS: Above answers worked because they explicitly mentioned a different version, which is not milestone or snapshot. IMO that's not the ideal solution.

kulsin
  • 398
  • 4
  • 18
2

If you try to update your IDE. It will fix the issue permanently. As, Apparently there was some bug in the IDE which got fixed in build No: Build #IU-211.7142.45, built on April 30, 2021.

Mohammad Faraz
  • 544
  • 4
  • 7
0

By default my configured snapshot project inherited from the spring-boot-starter-parent and set the parent. I added version number and it now as follows:

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.5.4</version>
</parent>

As docs suggests: "You should need to specify only the Spring Boot version number on this dependency. If you import additional starters, you can safely omit the version number. " https://docs.spring.io/spring-boot/docs/current/maven-plugin/reference/htmlsingle/

Gulbala Salamov
  • 198
  • 3
  • 9
0

To add to anyone coming across this problem, I am on WSL and my project was in the linux part of wsl (i.e, outside of the mnt folder). What DID fix the problem for me (after countrless tries to update the remote repository, invalidate caches, mvn clean compile and other similar things) was the following :

to cut one random dependency from my pom.xml file, click on the icon shown on Vivek Singh's answer and afterwards repaste that dependency and reclick on the icon.

Hope it helps someone.

Jonathan Simonney
  • 585
  • 1
  • 11
  • 25
0

After so many unsuccessful tries I just clicked on the Event Log on the bottom right of the IDE then found out that my pom file had become a non managed then chose to Add as a maven project and then the maven window reappeared

imdondo
  • 132
  • 2
  • 12
0

Just started type version from scratch and IDE suggested mopversion

0

go to File > invalidate cahes ... enter image description here

Ait Friha Zaid
  • 1,222
  • 1
  • 13
  • 20