1. Idea 新建springboot项目 spring-boot-starter-parent 包maven依赖报错
错误信息:
Project ‘org.springframework.boot:spring‐boot‐starter‐parent:1.5.9.RELEASE‘ not found less... (Ctrl+F1) Inspection info: Inspects a Maven model for resolution problems.解决方式
方法一:
重新敲一遍配置,不要复制,复制会有各种问题, 重新敲一遍重新导入就没有问题了方法二:换镜像
因为你未配置maven镜像使用的是默认的,建议在maven的setting中配置国内镜像; maven的setting配置和引入步骤;方法三:在pom.xml配置文件中加入下面这些配置
<repositories> <repository> <id>spring-snapshots</id> <url>http://repo.spring.io/libs-snapshot</url> </repository> </repositories> <pluginRepositories> <pluginRepository> <id>spring-snapshots</id> <url>http://repo.spring.io/libs-snapshot</url> </pluginRepository> </pluginRepositories>方法四:加入如下代码
<groupId>springboot.examples</groupId> <artifactId>spring-boot-hello</artifactId> <version>1.0-SNAPSHOT</version>groupId和artifactId是maven管理项目包时用作区分的字段,就像是地图上的坐标。
groupId:groupId分为几个字段,例如com.piggy,前面的com叫【域】,后面的是你自己起的域名。
artifactId:artifactId一般是项目名或者模块名。
【作用】
一般来说,包名根目录=groupId+artifactId。这个是不允许和别人重复的,尤其是需要上线的项目。一般公司为了不重 复都会注册一个域名(URL用的那种),这样就肯定不会重复了。但是自己用嘛就随便起一个喜欢易懂的好了。pom.xml
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>springboot.examples</groupId> <artifactId>spring-boot-hello</artifactId> <version>1.0-SNAPSHOT</version> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.3.2.RELEASE</version> </parent> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <version>1.3.2.RELEASE</version> </dependency> </dependencies> </project>2.expected START_TAG or END_TAG not TEXT (position: TEXT seen …
解决方法:
pom.xml中部分内容格式不正确,整理格式,删除多余空格。
3.Plugin ‘org.springframework.boot:spring-boot-maven-plugin:’ not found
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId>//这行红色 </plugin>解决方式,最后我通过给spring-boot-maven-plugin指定版本后成功解决。修改后如下:
<plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>2.2.6.RELEASE</version> </plugin>