spring cloud maven的配置有两种方式,第一种是官网提供的配置,项目的pom文件继承spring-boot、并且在dependencyManager添加spring cloud依赖,这种方式的使用了maven的继承,如果我们的项目有自己的parent pom,就出现问题了。因此我们可以使用另一种方式,先看下两种配置方式:
第一种方式
1 | <parent> |
第二种实现方式,需要在我们的parent pom中进行如下的配置:
1 | <dependencyManagement> |
我们继承该pom,如果想使用eureka模块,只需要添加该模块的依赖
1 | <dependencies> |
如果需要使用spring-boot-maven-plugin
插件,也需要在parent pom中进行配置。
1 | <build> |
在项目的pom中添加如下配置
1 | <build> |