spring cloud

【spring cloud系列(二)】- 微服务项目父工程搭建

2019-07-21  本文已影响0人  程序猿TT

微服务系列文章导航


源码地址


工程说明

该工程为以后所有模块的父工程,包括Eureka、zuul等,该模块管理了以后所有模块依赖的项目版本,主要做版本控制。

环境配置

  • IDE : intellij idea
  • java version: jdk.1.8
  • maven version : apache-maven-3.6.1

工程创建

file \Rightarrow new \Rightarrow module \Rightarrow maven \Rightarrow next \Rightarrow 输入groupid(com.ttcode) \Rightarrow 输入artifactid(framework-parent) \Rightarrow 输入version(1.0) \Rightarrow 输入module name(ms-framework-parent) \Rightarrow 输入工程路径(放入MicroServiceCode下) \Rightarrow finish

  • 配置打包类型 <packaging>pom</packaging>
  • 配置阿里云仓库
   <repositories>
       <repository>
           <id>public</id>
           <name>aliyun nexus</name>
           <url>http://maven.aliyun.com/nexus/content/groups/public/</url>
           <releases>
               <enabled>true</enabled>
           </releases>
       </repository>
   </repositories>
  • 配置依赖,将所有依赖放进标签 dependencyManagement
  • 说明 : 将所有的依赖放入dependencyManagement,子模块引用相应依赖的时候,只需要指定groupId和artifactId即可,父工程的作用就是将项目的依赖给统一管理起来。减少版本冲突

上一篇 下一篇

猜你喜欢

热点阅读