Spring-boot-maven-plugin not found(转载)
最近走spring Initializr初始化了一个工程,依赖里面仅仅加了lombok和spring-boot-starter-web,下载了打开之后报spring-boot-maven-plugin not found的报错。原始pom文件大概是下面这样的:<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://
·
最近走spring Initializr初始化了一个工程,依赖里面仅仅加了lombok和spring-boot-starter-web,下载了打开之后报spring-boot-maven-plugin not found的报错。
原始pom文件大概是下面这样的:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.4.0</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>com.github.jjn</groupId>
<artifactId>database</artifactId>
<version>1.0.0</version>
<name>database</name>
<description>Demo project for Spring Boot</description>
<properties>
<java.version>1.8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
首先按官方文档
所说的,如果spring-boot-starter-parent都找不到的话,需要添加下面俩插件仓库配置。
<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>
然后呢,emmm,依然是没能解决spring-boot-maven-plugin not found的问题,Re import也不起作用,很是郁闷。
最后去maven中央仓库里翻到了最新版本的jar包依赖:
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-maven-plugin -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.4.0</version>
</dependency>
添加到依赖里,再Re import就可以了,至此解决问题!
最后强烈安利一下Maven Helper这个插件,实乃神器!再也不需要到IDEA右边的菜单里翻这些隐藏的功能了,直接右键就能翻出来!还能一键分析项目依赖,解决Jar包冲突,甚是好使!
更多推荐
已为社区贡献14条内容
所有评论(0)