今天在搭建SpringCloud Eureka过程中,一直在报pom依赖错误,排查问题总结如下经验。
1、SpringBoot整合SpringCloud两者版本是有严格约束的,详细见SpringBoot官方文档(https://spring.io/projects/spring-cloud):
正确依赖示例:
2、新版本的eureka server 的依赖artifactId已经变化,spring boot、spring cloud里面很多包引用、包名等配置更新的很快,注意时刻关注官网。
<artifactId>spring-cloud-starter-eureka-server</artifactId> ---> <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId>
maven仓库官方描述:https://mvnrepository.com/artifact/org.springframework.cloud/spring-cloud-starter-eureka-server
3、maven jar包依赖错误,再次更新可能无法下载正确的jar包,请删除之前下载的jar包重新更新下载。
4、正确的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 http://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.0.2.RELEASE</version> <relativePath/> </parent> <groupId>com.github.gavincoder</groupId> <artifactId>eureka-server</artifactId> <version>0.0.1-SNAPSHOT</version> <name>eureka-server</name> <properties> <java.version>1.8</java.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> </dependency> <!--eureka-server服务端引入 --> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-starter-netflix-eureka-server</artifactId> </dependency> </dependencies> <dependencyManagement> <dependencies> <dependency> <groupId>org.springframework.cloud</groupId> <artifactId>spring-cloud-dependencies</artifactId> <version>Finchley.SR2</version> <type>pom</type> <scope>import</scope> </dependency> </dependencies> </dependencyManagement> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build> </project>
天在搭建SpringCloud Eureka过程中,一直在报pom依赖错误,排查问题总结如下经验。
1、SpringBoot整合SpringCloud两者版本是有严格约束的,详细见SpringBoot官方文档(https://spring.io/projects/spring-cloud):